aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-09-20libstdc++: fix C header include guardsJason Merrill37-95/+92
Ever since the c_global and c_compatibility directories were added in r122533, the include guards have been oddly late in the files, with no comment about why that might be either in the commit message or the files themselves. I don't see any justification for this; it seems like a scripting error in creating these files based on the ones in include/c. libstdc++-v3/ChangeLog: * include/c_compatibility/ctype.h * include/c_compatibility/errno.h * include/c_compatibility/float.h * include/c_compatibility/iso646.h * include/c_compatibility/limits.h * include/c_compatibility/locale.h * include/c_compatibility/setjmp.h * include/c_compatibility/signal.h * include/c_compatibility/stdarg.h * include/c_compatibility/stdbool.h * include/c_compatibility/stddef.h * include/c_compatibility/stdio.h * include/c_compatibility/string.h * include/c_compatibility/tgmath.h * include/c_compatibility/time.h * include/c_compatibility/uchar.h * include/c_compatibility/wchar.h * include/c_compatibility/wctype.h * include/c_global/ccomplex * include/c_global/cctype * include/c_global/cerrno * include/c_global/cfloat * include/c_global/climits * include/c_global/clocale * include/c_global/cmath * include/c_global/csetjmp * include/c_global/csignal * include/c_global/cstdalign * include/c_global/cstdarg * include/c_global/cstdbool * include/c_global/cstdio * include/c_global/cstdlib * include/c_global/cstring * include/c_global/ctgmath * include/c_global/ctime * include/c_global/cwchar * include/c_global/cwctype: Move header guard before #includes.
2024-09-21Daily bump.GCC Administrator13-1/+412
2024-09-20diagnostics: add HTML output format as a plugin [PR116792]David Malcolm3-0/+887
This patch adds an experimental diagnostics output format that writes HTML. It isn't ready yet for end-users, but seems worth keeping in the tree as I refactor the diagnostics subsystem, to ensure that this code still builds, and to verify that it's possible to implement new diagnostic output formats via GCC plugins. Hence this patch merely adds it to the testsuite as an example of a GCC plugin, rather than exposing it as a feature for end-users. gcc/testsuite/ChangeLog: PR other/116792 * gcc.dg/plugin/diagnostic-test-xhtml-1.c: New test. * gcc.dg/plugin/diagnostic_plugin_xhtml_format.c: New test plugin. * gcc.dg/plugin/plugin.exp (plugin_test_list): Add the above. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-09-20analyzer: simplify dumps using tree_dump_pretty_printer [PR116613]David Malcolm19-171/+55
There are numerous "dump" member functions in the analyzer with copied-and-pasted logic. Simplify them by moving the shared code to a new class tree_dump_pretty_printer. As well as reducing code duplication, this eliminates numerous uses of pp_show_color (global_dc->m_printer), which should ultimately help with supporting multiple diagnostic sinks. No functional change intended. gcc/analyzer/ChangeLog: PR other/116613 * access-diagram.cc (access_range::dump): Simplify using tree_dump_pretty_printer. * call-details.cc (call_details::dump): Likewise. * call-summary.cc (call_summary::dump): Likewise. (call_summary_replay::dump): Likewise. * checker-event.cc (checker_event::debug): Likewise. * constraint-manager.cc (range::dump): Likewise. (bounded_range::dump): Likewise. (bounded_ranges::dump): Likewise. (constraint_manager::dump): Likewise. * engine.cc (exploded_node::dump): Likewise. (exploded_path::dump): Likewise. * program-point.cc (program_point::dump): Likewise. * program-state.cc (extrinsic_state::dump_to_file): Likewise. (sm_state_map::dump): Likewise. (program_state::dump_to_file): Likewise. * ranges.cc (symbolic_byte_offset::dump): Likewise. (symbolic_byte_range::dump): Likewise. * record-layout.cc (record_layout::dump): Likewise. * region-model-reachability.cc (reachable_regions::dump): Likewise. * region-model.cc (region_to_value_map::dump): Likewise. (region_model::dump): Likewise. (model_merger::dump): Likewise. * region.cc (region_offset::dump): Likewise. (region::dump): Likewise. * sm-malloc.cc (deallocator_set::dump): Likewise. * store.cc (uncertainty_t::dump): Likewise. (binding_key::dump): Likewise. (bit_range::dump): Likewise. (byte_range::dump): Likewise. (binding_map::dump): Likewise. (binding_cluster::dump): Likewise. (store::dump): Likewise. * supergraph.cc (superedge::dump): Likewise. * svalue.cc (svalue::dump): Likewise. gcc/ChangeLog: PR other/116613 * text-art/dump.h (dump_to_file): Simplify using tree_dump_pretty_printer. * tree-diagnostic.h (class tree_dump_pretty_printer): New. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-09-20diagnostics: isolate SARIF output's pretty_printer [PR116613]David Malcolm2-67/+51
Add an m_printer to sarif_builder and use throughout, rather than using the context's printer. For now this is the same printer, but eventually this should help with transitioning to multiple output sinks. No functional change intended. gcc/ChangeLog: PR other/116613 * diagnostic-format-sarif.cc (sarif_builder::m_printer): New field. (sarif_invocation::add_notification_for_ice): Drop context param. (sarif_invocation::prepare_to_flush): Convert param from context to builder. (sarif_result::on_nested_diagnostic): Drop context param. Use builder's printer. (sarif_result::on_diagram): Drop context param. (sarif_ice_notification::sarif_ice_notification): Drop context param. Use builder's printer. (sarif_builder::sarif_builder): Initialize m_printer. (sarif_builder::on_report_diagnostic): Drop context param. Use builder's printer. (sarif_builder::emit_diagram): Drop context param. (sarif_builder::flush_to_object): Use this rather than context for call to prepare_to_flush. (sarif_builder::make_result_object): Drop context param. Use builder's printer. (sarif_builder::make_reporting_descriptor_object_for_warning): Drop context param. (sarif_builder::make_message_object_for_diagram): Likewise. Use builder's printer. (sarif_output_format::on_report_diagnostic): Drop context param from call to sarif_builder::on_report_diagnostic. (sarif_output_format::on_diagram): Drop context param from call to sarif_builder::emit_diagram. * diagnostic.h (diagnostic_conetxt::get_client_data_hooks): Make const. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-09-20diagnostics: convert text hooks to use diagnostic_text_output_format [PR116613]David Malcolm26-475/+587
The diagnostic_starter and diagnostic_finalizer callbacks and most of their support subroutines are only used by the "text" output format. Emphasize this and reduce the binding with diagnostic_context by renaming the callbacks to add "_text" in their names, and converting the first param from diagnostic_context * to diagnostic_text_output_output &. Update the various subroutines used by diagnostic starter/finalizer callbacks to also take a diagnostic_text_output_output & rather than a diagnostic_context *. Move m_includes and m_last_seen from the context to the text output. Use the text_output's get_printer () rather than the context's m_printer, which should ease the transition to multiple output sinks. No functional change intended. gcc/c-family/ChangeLog: PR other/116613 * c-opts.cc: Include "diagnostic-format-text.h". (c_diagnostic_finalizer): Rename to... (c_diagnostic_text_finalizer): ...this. Convert first param from diagnostic_context * to diagnostic_text_output_format & and update accordingly. (c_common_diagnostics_set_defaults): Update for renamings. gcc/ChangeLog: PR other/116613 * coretypes.h (class diagnostic_text_output_format): Add forward decl. * diagnostic-format-json.cc (json_output_format::after_diagnostic): New. * diagnostic-format-sarif.cc (sarif_output_format::after_diagnostic): New. * diagnostic-format-text.cc: Use pragmas to ignore -Wformat-diag. (diagnostic_text_output_format::~diagnostic_text_output_format): Use get_printer. Clean up m_includes_seen here, rather than in ~diagnostic_context. (diagnostic_text_output_format::on_report_diagnostic): Use get_printer. Update for callback renamings and pass *this to them, rather than &m_context. (diagnostic_text_output_format::after_diagnostic): New. (diagnostic_text_output_format::includes_seen_p): Move here from diagnostic_context/diagnostic.cc. (diagnostic_text_output_format::get_location_text): New. (maybe_line_and_column): Move here from diagnostic.cc and make non-static. (diagnostic_text_output_format::report_current_module): Move here from diagnostic_context/diagnostic.cc. (default_diagnostic_text_starter): Move here from diagnostic.cc, renaming from default_diagnostic_starter. (default_diagnostic_text_finalizer): Likewise, renaming from default_diagnostic_finalizer. * diagnostic-format-text.h (diagnostic_text_output_format::diagnostic_text_output_format): Initialize m_last_module and m_includes_seen. (diagnostic_text_output_format::after_diagnostic): New decl. (diagnostic_text_output_format::build_prefix): New decl. (diagnostic_text_output_format::report_current_module): New decl. (diagnostic_text_output_format::append_note): New decl. (diagnostic_text_output_format::file_name_as_prefix): New decl. (diagnostic_text_output_format::print_path): New decl. (diagnostic_text_output_format::show_column_p): New decl. (diagnostic_text_output_format::get_location_text): New decl. (diagnostic_text_output_format::includes_seen_p): New decl. (diagnostic_text_output_format::show_any_path): New decl. (diagnostic_text_output_format::m_last_module): New field. (diagnostic_text_output_format::m_includes_seen): New field. * diagnostic-format.h (diagnostic_output_format::after_diagnostic): New vfunc. (diagnostic_output_format::get_context): New. (diagnostic_output_format::get_diagram_theme): New. * diagnostic-macro-unwinding.cc: Include "diagnostic-format-text.h". (maybe_unwind_expanded_macro_loc): Convert first param from diagnostic_context * to diagnostic_text_output_format & and update accordingly. (virt_loc_aware_diagnostic_finalizer): Likewise. * diagnostic-macro-unwinding.h (virt_loc_aware_diagnostic_finalizer): Likewise. (maybe_unwind_expanded_macro_loc): Likewise. * diagnostic-path.cc: Include "diagnostic-format-text.h". (path_label::path_label): Drop "ctxt" param and add "colorize" and "allow_emojis" params. Update initializations. (path_label::get_text): Use m_colorize rather than querying m_ctxt.m_printer. Use m_allow_emojis rather than querying m_ctxt's diagram theme. (path_label::m_ctxt): Drop field. (path_label::m_colorize): Drop field. (path_label::m_allow_emojis): Drop field. (event_range::event_range): Drop param "ctxt". Add params "colorize_labels" and "allow_emojis". (event_range::print): Convert first param from diagnostic_context & to diagnostic_text_output_format & and update accordingly. (path_summary::path_summary): Likewise. (path_summary::print_swimlane_for_event_range): Likewise. (print_path_summary_as_text): Likewise for 3rd param. (diagnostic_context::print_path): Convert to... (diagnostic_text_output_format::print_path): ...this. (selftest::test_empty_path): Update to use a diagnostic_text_output_format. (selftest::test_intraprocedural_path): Likewise. (selftest::test_interprocedural_path_1): Likewise. (selftest::test_interprocedural_path_2): Likewise. (selftest::test_recursion): Likewise. (selftest::test_control_flow_1): Likewise. (selftest::test_control_flow_2): Likewise. (selftest::test_control_flow_3): Likewise. (selftest::assert_cfg_edge_path_streq): Likewise. (selftest::test_control_flow_5): Likewise. (selftest::test_control_flow_6): Likewise. * diagnostic.cc (file_name_as_prefix): Convert to... (diagnostic_text_output_format::file_name_as_prefix): ...this. (diagnostic_context::initialize): Update for renamings. Move m_last_module and m_includes_seen into text output. (diagnostic_context::finish): Likewise. (diagnostic_context::get_location_text): Add "colorize" param. (diagnostic_build_prefix): Convert to... (diagnostic_text_output_format::build_prefix): ...this. (diagnostic_context::includes_seen_p): Move from here to diagnostic_text_output_format/diagnostic-format-text.cc. (diagnostic_context::report_current_module): Likewise. (diagnostic_context::show_any_path): Convert to... (diagnostic_text_output_format::show_any_path): ...this. (default_diagnostic_starter): Rename and move to diagnostic-format-text.cc. (default_diagnostic_start_span_fn): Pass colorize bool to get_location_text. (default_diagnostic_finalizer): Rename and move to diagnostic-format-text.cc. (diagnostic_context::report_diagnostic): Replace call to show_any_path with call to new output format "after_diagnostic" vfunc, moving show_any_path call to the text output format. (diagnostic_append_note): Convert to... (diagnostic_text_output_format::append_note): ...this. (selftest::assert_location_text): Pass in false for colorization. * diagnostic.h (diagnostic_starter_fn): Rename to... (diagnostic_text_starter_fn): ...this. Convert first param from diagnostic_context * to diagnostic_text_output_format &. (diagnostic_finalizer_fn, diagnostic_text_finalizer_fn): Likewise. (diagnostic_context): Update friends for renamings. (diagnostic_context::report_current_module): Move to text output format. (diagnostic_context::get_location_text): Add "colorize" bool. (diagnostic_context::includes_seen_p): Move to text output format. (diagnostic_context::show_any_path): Likewise. (diagnostic_context::print_path): Likewise. (diagnostic_context::m_text_callbacks): Update for renamings. (diagnostic_context::m_last_module): Move to text output format. (diagnostic_context::m_includes_seen): Likewise. (diagnostic_starter): Rename to... (diagnostic_text_starter): ...this and update return type. (diagnostic_finalizer): Rename to... (diagnostic_text_finalizer): ...this and update return type. (diagnostic_report_current_module): Drop decl in favor of a member function of diagnostic_text_output_format. (diagnostic_append_note): Likewise. (default_diagnostic_starter): Rename to... (default_diagnostic_text_starter): ...this, updating type. (default_diagnostic_finalizer): Rename to... (default_diagnostic_text_finalizer): ...this, updating type. (file_name_as_prefix): Drop decl. * langhooks-def.h (lhd_print_error_function): Convert first param from diagnostic_context * to diagnostic_text_output_format &. * langhooks.cc: Include "diagnostic-format-text.h". (lhd_print_error_function): Likewise. Update accordingly * langhooks.h (lang_hooks::print_error_function): Convert first param from diagnostic_context * to diagnostic_text_output_format &. * tree-diagnostic.cc: Include "diagnostic-format-text.h". (diagnostic_report_current_function): Convert first param from diagnostic_context * to diagnostic_text_output_format & and update accordingly. (default_tree_diagnostic_starter): Rename to... (default_tree_diagnostic_text_starter): ...this. Convert first param from diagnostic_context * to diagnostic_text_output_format & and update accordingly. (tree_diagnostics_defaults): Update for renamings. gcc/cp/ChangeLog: PR other/116613 * cp-tree.h (cxx_print_error_function): Convert first param from diagnostic_context * to diagnostic_text_output_format &. * error.cc: Include "diagnostic-format-text.h". (cxx_initialize_diagnostics): Update for renamings. (cxx_print_error_function): Convert first param from diagnostic_context * to diagnostic_text_output_format & and update accordingly (cp_diagnostic_starter): Rename to... (cp_diagnostic_text_starter): ...this. Convert first param from diagnostic_context * to diagnostic_text_output_format & and update accordingly. (cp_print_error_function): Likewise. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context_line): Likewise. (print_instantiation_partial_context): Likewise. (maybe_print_instantiation_context): Likewise. (maybe_print_constexpr_context): Likewise. (print_location): Likewise. (print_constrained_decl_info): Likewise. (print_concept_check_info): Likewise. (print_constraint_context_head): Likewise. (print_requires_expression_info): Likewise. (maybe_print_single_constraint_context): Likewise. gcc/fortran/ChangeLog: PR other/116613 * error.cc: Include "diagnostic-format-text.h". (gfc_diagnostic_starter): Rename to... (gfc_diagnostic_text_starter): ...this. Convert first param from diagnostic_context * to diagnostic_text_output_format & and update accordingly. (gfc_diagnostic_finalizer, gfc_diagnostic_text_finalizer): Likewise. (gfc_diagnostics_init): Update for renamings. (gfc_diagnostics_finish): Likewise. gcc/jit/ChangeLog: PR other/116613 * dummy-frontend.cc: Include "diagnostic-format-text.h". (jit_begin_diagnostic): Convert first param from diagnostic_context * to diagnostic_text_output_format & (jit_end_diagnostic): Likewise. Update accordingly. (jit_langhook_init): Update for renamings. gcc/rust/ChangeLog: PR other/116613 * resolve/rust-ast-resolve-expr.cc (funny_ice_finalizer): : Convert first param from diagnostic_context * to diagnostic_text_output_format &. (ResolveExpr::visit): Update for renaming. gcc/testsuite/ChangeLog: PR other/116613 * g++.dg/plugin/show_template_tree_color_plugin.c (noop_starter_fn): Rename to... (noop_text_starter_fn): ...this. Update first param from dc to text_output. (plugin_init): Update for renamings. * gcc.dg/plugin/diagnostic_group_plugin.c (test_diagnostic_starter): Rename to... (test_diagnostic_text_starter): ...this. Update first param from dc to text_output. (plugin_init): Update for renaming. * gcc.dg/plugin/diagnostic_plugin_test_show_locus.c: Include "diagnostic-format-text.h". (custom_diagnostic_finalizer): Rename to... (custom_diagnostic_text_finalizer): ...this. Update first param from dc to text_output. (test_show_locus): Update for renamings. * gcc.dg/plugin/location_overflow_plugin.c: Include "diagnostic-format-text.h". (original_finalizer): Rename to... (original_text_finalizer): ...this and update type. (verify_unpacked_ranges): Update first param from dc to text_output. Update for this and for renamings. (verify_no_columns): Likewise. (plugin_init): Update for renamings. libcc1/ChangeLog: PR other/116613 * context.cc: Include "diagnostic-format-text.h". (plugin_print_error_function): Update first param from diagnostic_context * to diagnostic_text_output_format &. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-09-20analyzer: remove redundant 'pp' [PR116613]David Malcolm1-3/+0
diagnostic_manager::emit_saved_diagnostic makes a useless clone of global_dc->m_printer; remove it. No functional change intended. gcc/analyzer/ChangeLog: PR other/116613 * diagnostic-manager.cc (diagnostic_manager::emit_saved_diagnostic): Remove remove redundant 'pp'. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-09-20libstdc++: Avoid forming T* in unique_ptr(auto_ptr<U>&&) constraints [PR116529]Jonathan Wakely2-2/+38
PR 116529 shows that std::unique_ptr<X&, D> is currently unusable because the constructor taking std::auto_ptr (which is a non-standard extension since C++17) tries to form the invalid type X&* during overload resolution. We can use the `pointer` type in the constructor constraints, instead of trying to form an invalid type. The std::auto_ptr constructor can never actually match for the case where element_type is a reference, so we just need it to produce a substitution failure instead of being ill-formed. LWG 4144 might make std::unique_ptr<X&, D> ill-formed, which would invalidate this new test. We would have to remove this test in that case. Using `pointer` in the constructor from std::auto_ptr would not be needed to support the std::unique_ptr<X&, D> case, but would not cause any harm either. libstdc++-v3/ChangeLog: PR libstdc++/116529 * include/bits/unique_ptr.h (unique_ptr(auto_ptr<U>&&)): Use pointer instead of T*. * testsuite/20_util/unique_ptr/creation/116529.cc: New test.
2024-09-20libstdc++: Document missing features for old std:string ABI [PR116777]Jonathan Wakely2-2/+42
There are several features that are not supported when using the old std::string ABI. It's possible that PR 81967 will get fixed, but the missing C++20 features almost certainly won't be. Document this in the manual. libstdc++-v3/ChangeLog: PR libstdc++/116777 * doc/xml/manual/using.xml: Document features that are not supported for the gcc4-compatible ABI. * doc/html/manual/using_dual_abi.html: Regenerate.
2024-09-20c: fix crash when checking for compatibility of structures [PR116726]Martin Uecker2-1/+22
When checking for compatibility of structure or union types in tagged_types_tu_compatible_p, restore the old value of the pointer to the top of the temporary cache after recursively calling comptypes_internal when looping over the members of a structure of union. While the next iteration of the loop overwrites the pointer, I missed the fact that it can be accessed again when types of function arguments are compared as part of recursive type checking and the function is entered again. PR c/116726 gcc/c/ChangeLog: * c-typeck.cc (tagged_types_tu_compatible_p): Restore value of the cache after recursing into comptypes_internal. gcc/testsuite/ChangeLog: * gcc.dg/pr116726.c: New test.
2024-09-20c++: CWG 2789 and reversed operator candidatesPatrick Palka2-7/+10
As a follow-up to r15-3741-gee3efe06c9c49c, which was specifically concerned with usings, it seems the CWG 2789 refinement should also compare contexts of a reversed vs non-reversed (member) candidate during operator overload resolution. DR 2789 gcc/cp/ChangeLog: * call.cc (cand_parms_match): Check for matching class contexts even in the reversed case. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/concepts-memfun4.C: Adjust expected result involving reversed candidate. Reviewed-by: Jason Merrill <jason@redhat.com>
2024-09-20modula2: Remove unused parameter warnings seen in buildGaius Mulley9-15/+213
This patch removes unused parameters in gm2-compiler/M2Check.mod. It also removes a --fixme-- and completes the missing code which type checks unbounded arrays. The patch also fixes a build error seen when building m2/stage2/cc1gm2. gcc/m2/ChangeLog: * gm2-compiler/M2Check.mod (checkUnboundedArray): New procedure function. (checkUnboundedUnbounded): Ditto. (checkUnbounded): Rewrite to check the unbounded data type. (checkPair): Add comment. (doCheckPair): Add comment. Remove tinfo parameter from the call to checkTypeKindViolation. (checkTypeKindViolation): Remove ununsed parameter tinfo. * gm2-libs-ch/UnixArgs.cc (GM2RTS.h): Remove include. * gm2-libs-ch/m2rts.h (M2RTS_INIT): New define. (M2RTS_DEP): Ditto. (M2RTS_RegisterModule): New prototype. (GM2RTS.h): Add include to the MC_M2 block. gcc/testsuite/ChangeLog: * gm2/iso/fail/testarrayunbounded2.mod: New test. * gm2/iso/fail/testarrayunbounded3.mod: New test. * gm2/iso/fail/testarrayunbounded4.mod: New test. * gm2/iso/fail/testarrayunbounded5.mod: New test. * gm2/iso/fail/testarrayunbounded6.mod: New test. * gm2/iso/pass/testarrayunbounded.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2024-09-20Daily bump.GCC Administrator11-1/+584
2024-09-20c++: CWG 2789 and usings [PR116492]Patrick Palka3-45/+49
After CWG 2789, the "more constrained" tiebreaker for non-template functions should exclude member functions that are defined in different classes. This patch implements this missing refinement. In turn we can get rid of four-parameter version of object_parms_correspond and call the main overload directly since now correspondence is only only checked for members from the same class. PR c++/116492 DR 2789 gcc/cp/ChangeLog: * call.cc (object_parms_correspond): Remove. (cand_parms_match): Return false for member functions that come from different classes. Adjust call to object_parms_correspond. (joust): Update comment for the non-template "more constrained" case. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/concepts-memfun4.C: Also compile in C++20 mode. Expect ambiguity when candidates come from different classes. * g++.dg/cpp2a/concepts-inherit-ctor12.C: New test. Reviewed-by: Jason Merrill <jason@redhat.com>
2024-09-20c++: CWG 2273 and non-constructorsPatrick Palka3-12/+9
Our implementation of the CWG 2273 inheritedness tiebreaker seems to be incorrectly considering all member functions introduced via using, not just constructors. This patch restricts the tiebreaker accordingly. DR 2273 gcc/cp/ChangeLog: * call.cc (joust): Restrict inheritedness tiebreaker to constructors. gcc/testsuite/ChangeLog: * g++.dg/cpp1z/using1.C: Expect ambiguity for non-constructor call. * g++.dg/overload/using5.C: Likewise. Reviewed-by: Jason Merrill <jason@redhat.com>
2024-09-20AArch64: Define VECTOR_STORE_FLAG_VALUE.Tamar Christina2-0/+39
This defines VECTOR_STORE_FLAG_VALUE to CONST1_RTX for AArch64 so we simplify vector comparisons in AArch64. With this enabled res: movi v0.4s, 0 cmeq v0.4s, v0.4s, v0.4s ret is simplified to: res: mvni v0.4s, 0 ret gcc/ChangeLog: * config/aarch64/aarch64.h (VECTOR_STORE_FLAG_VALUE): New. gcc/testsuite/ChangeLog: * gcc.dg/rtl/aarch64/vector-eq.c: New test.
2024-09-20testsuite: Update commandline for PR116628.c to use neoverse-v2 [PR116628]Tamar Christina1-1/+1
The testcase for this tests needs Neoverse V2 to be used since due to costing the other cost models don't pick this particular SVE mode. committed as obvious. Thanks, Tamar gcc/testsuite/ChangeLog: PR tree-optimization/116628 * gcc.dg/vect/pr116628.c: Update cmdline.
2024-09-20Darwin: Allow for as versions that need '-' for std in.Iain Sandoe1-0/+2
Recent versions of Xcode as require a dash to read from standard input. We can use this on all supported OS versions so make it unconditional. Patch from Mark Mentovai. gcc/ChangeLog: * config/darwin.h (AS_NEEDS_DASH_FOR_PIPED_INPUT): New. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2024-09-20c++, coroutines: Rework the ramp codegen.Iain Sandoe1-138/+150
Now that we have separated the codegen of the ramp, actor and destroy functions, we no longer need to manage the scopes for variables manually. This introduces a helper function that allows us to build a local var with a DECL_VALUE_EXPR that relates to the coroutine state frame entry. This fixes a latent issue where we would generate guard vars when exceptions were disabled. gcc/cp/ChangeLog: * coroutines.cc (coro_build_artificial_var_with_dve): New. (coro_build_and_push_artificial_var): New. (coro_build_and_push_artificial_var_with_dve): New. (analyze_fn_parms): Ensure that frame entries cannot clash with local variables. (build_coroutine_frame_delete_expr): Amend comment. (cp_coroutine_transform::build_ramp_function): Rework to avoid manual management of variables and scopes. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2024-09-20Fall back to elementwise access for too spaced SLP single element interleavingRichard Biener2-16/+23
gcc.dg/vect/vect-pr111779.c is a case where non-SLP manages to vectorize using VMAT_ELEMENTWISE but SLP currently refuses because doing a regular access with permutes would cause excess vector loads with at most one element used. The following makes us fall back to elementwise accesses for that, too. * tree-vect-stmts.cc (get_group_load_store_type): Fall back to VMAT_ELEMENTWISE when single element interleaving of a too large group. (vectorizable_load): Do not try to verify load permutations when using VMAT_ELEMENTWISE for single-lane SLP and fix code generation for this case. * gfortran.dg/vect/vect-8.f90: Allow one more vectorized loop.
2024-09-20Handle patterns as SLP roots of only live stmtsRichard Biener1-0/+1
gcc.dg/vect/vect-live-2.c shows it's important to handle live but otherwise unused pattern stmts. * tree-vect-slp.cc (vect_analyze_slp): Lookup patterns when discovering from only-live roots.
2024-09-20s390: Remove -m{,no-}lra optionStefan Schulze Frielinghaus5-72/+0
Since the old reload pass is about to be removed and we defaulted to LRA for over a decade, remove option -m{,no-}lra. PR target/113953 gcc/ChangeLog: * config/s390/s390.cc (s390_lra_p): Remove. (TARGET_LRA_P): Remove. * config/s390/s390.opt (mlra): Remove. * config/s390/s390.opt.urls (mlra): Remove. gcc/testsuite/ChangeLog: * gcc.target/s390/TI-constants-nolra.c: Removed. * gcc.target/s390/pr79895.c: Removed.
2024-09-20testsuite/116397 - avoid looking for "VEC_PERM_EXPR"Richard Biener1-1/+1
With SLP this token appears a lot, when looking for what gets code generated instead look for " = VEC_PERM_EXPR" PR testsuite/116397 * gcc.dg/vect/slp-reduc-3.c: Look for " = VEC_PERM_EXPR" instead of "VEC_PERM_EXPR".
2024-09-20Fix small thinko in IPA mod/ref passEric Botcazou2-1/+36
When a memory copy operation is analyzed by analyze_ssa_name, if both the load and store are made through the same SSA name, the store is overlooked. gcc/ * ipa-modref.cc (modref_eaf_analysis::analyze_ssa_name): Always process both the load and the store of a memory copy operation. gcc/testsuite/ * gcc.dg/ipa/modref-4.c: New test.
2024-09-20OpenMP: Add get_device_from_uid/omp_get_uid_from_device routinesTobias Burnus18-7/+384
Those TR13/OpenMP 6.0 routines permit a reproducible offloading to a specific device by mapping an OpenMP device number to a unique ID (UID). The GPU device UIDs should be universally unique, the one for the host is not. gcc/ChangeLog: * omp-general.cc (omp_runtime_api_procname): Add get_device_from_uid and omp_get_uid_from_device routines. include/ChangeLog: * cuda/cuda.h (cuDeviceGetUuid): Declare. (cuDeviceGetUuid_v2): Add prototype. libgomp/ChangeLog: * config/gcn/target.c (omp_get_uid_from_device, omp_get_device_from_uid): Add stub implementation. * config/nvptx/target.c (omp_get_uid_from_device, omp_get_device_from_uid): Likewise. * fortran.c (omp_get_uid_from_device_, omp_get_uid_from_device_8_): New functions. * libgomp-plugin.h (GOMP_OFFLOAD_get_uid): Add prototype. * libgomp.h (struct gomp_device_descr): Add 'uid' and 'get_uid_func'. * libgomp.map (GOMP_6.0): New, includind the new UID routines. * libgomp.texi (OpenMP Technical Report 13): Mark UID routines as 'Y'. (Device Information Routines): Document new UID routines. (Offload-Target Specifics): Document UID format. * omp.h.in (omp_get_device_from_uid, omp_get_uid_from_device): New prototype. * omp_lib.f90.in (omp_get_device_from_uid, omp_get_uid_from_device): New interface. * omp_lib.h.in: Likewise. * plugin/cuda-lib.def: Add cuDeviceGetUuid and cuDeviceGetUuid_v2 via CUDA_ONE_CALL_MAYBE_NULL. * plugin/plugin-gcn.c (GOMP_OFFLOAD_get_uid): New. * plugin/plugin-nvptx.c (GOMP_OFFLOAD_get_uid): New. * target.c (str_omp_initial_device): New static var. (STR_OMP_DEV_PREFIX): Define. (gomp_get_uid_for_device, omp_get_uid_from_device, omp_get_device_from_uid): New. (gomp_load_plugin_for_device): DLSYM_OPT the function 'get_uid'. (gomp_target_init): Set the device's 'uid' field to NULL. * testsuite/libgomp.c/device_uid.c: New test. * testsuite/libgomp.fortran/device_uid.f90: New test.
2024-09-20testsuite: fix target-specific 'do-' typosSam James4-4/+4
Fix some target-specific 'do-' (rather than 'dg-') typos. gcc/testsuite/ChangeLog: * gcc.target/m68k/pr108640.c: Fix dg directive typo. * gcc.target/m68k/pr110934.c: Ditto. * gcc.target/m68k/pr82420.c: Ditto. * gcc.target/powerpc/pr99708.c: Ditto.
2024-09-20i386: Fix up _mm_min_ss etc. handling of zeros and NaNs [PR116738]Jakub Jelinek3-1/+71
min/max patterns for intrinsics which on x86 result in the second input operand if the two operands are both zeros or one or both of them are a NaN shouldn't use SMIN/SMAX RTL, because that is similarly to MIN_EXPR/MAX_EXPR undefined what will be the result in those cases. The following patch adds an expander which uses either a new pattern with UNSPEC_IEEE_M{AX,IN} or use the S{MIN,MAX} representation of the same. 2024-09-20 Uros Bizjak <ubizjak@gmail.com> Jakub Jelinek <jakub@redhat.com> PR target/116738 * config/i386/subst.md (mask_scalar_operand_arg34, mask_scalar_expand_op3, round_saeonly_scalar_mask_arg3): New subst attributes. * config/i386/sse.md (<sse>_vm<code><mode>3<mask_scalar_name><round_saeonly_scalar_name>): Change from define_insn to define_expand, rename the old define_insn to ... (*<sse>_vm<code><mode>3<mask_scalar_name><round_saeonly_scalar_name>): ... this. (<sse>_ieee_vm<ieee_maxmin><mode>3<mask_scalar_name><round_saeonly_scalar_name>): New define_insn. * gcc.target/i386/sse-pr116738.c: New test.
2024-09-20testsuite/116784 - match up SLP scan and vectorized scanRichard Biener1-2/+2
The test used vect_perm_short for the vectorized scanning but vect_perm3_short for whether that's done with SLP. We're now generally expecting SLP to be used - even as fallback, so the following adjusts both to match up, fixing the powerpc64 reported testsuite issue. PR testsuite/116784 * gcc.dg/vect/slp-perm-9.c: Use vect_perm_short also for the SLP check.
2024-09-20testsuite: debug: fix errant whitespaceSam James1-1/+0
I added some whitespace unintentionally in r15-3723-g284c03ec79ec20, fix that. gcc/testsuite/ChangeLog: * gcc.dg/debug/btf/btf-datasec-1.c: Fix whitespace.
2024-09-20testsuite: fix 'do-do' typosSam James5-8/+8
Fix 'do-do' typos (should be 'dg-do'). No change in logs. gcc/testsuite/ChangeLog: * g++.dg/other/operator2.C: Fix dg-do directive. * gcc.dg/Warray-bounds-67.c: Ditto. * gcc.dg/cpp/builtin-macro-1.c: Ditto. * gcc.dg/tree-ssa/builtin-snprintf-3.c: Ditto. * obj-c++.dg/empty-private-1.mm: Ditto.
2024-09-20Remove PHI_RESULT_PTR and change some PHI_RESULT to be gimple_phi_result ↵Andrew Pinski2-6/+5
[PR116643] There was only a few uses PHI_RESULT_PTR so lets remove it and use gimple_phi_result_ptr or gimple_phi_result directly instead. Since I was modifying ssa-iterators.h for the use of PHI_RESULT_PTR, change the use of PHI_RESULT there to be gimple_phi_result instead. This also removes one extra indirection that was done for PHI_RESULT so stage2 building should be slightly faster. Bootstrapped and tested on x86_64-linux-gnu. PR middle-end/116643 gcc/ChangeLog: * ssa-iterators.h (single_phi_def): Use gimple_phi_result instead of PHI_RESULT. (op_iter_init_phidef): Use gimple_phi_result/gimple_phi_result_ptr instead of PHI_RESULT/PHI_RESULT_PTR. * tree-ssa-operands.h (PHI_RESULT_PTR): Remove. (PHI_RESULT): Use gimple_phi_result directly. (SET_PHI_RESULT): Use gimple_phi_result_ptr directly. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2024-09-20testsuite: debug: fix dejagnu directive syntaxSam James55-55/+56
In this case, they were all harmless in reality (no diff in test logs). gcc/testsuite/ChangeLog: * gcc.dg/debug/btf/btf-array-1.c: Fix dg-do directive syntax. * gcc.dg/debug/btf/btf-bitfields-1.c: Ditto. * gcc.dg/debug/btf/btf-bitfields-2.c: Ditto. * gcc.dg/debug/btf/btf-datasec-1.c: Ditto. * gcc.dg/debug/btf/btf-union-1.c: Ditto. * gcc.dg/debug/ctf/ctf-anonymous-struct-1.c: Ditto. * gcc.dg/debug/ctf/ctf-anonymous-union-1.c: Ditto. * gcc.dg/debug/ctf/ctf-array-1.c: Ditto. * gcc.dg/debug/ctf/ctf-array-2.c: Ditto. * gcc.dg/debug/ctf/ctf-array-4.c: Ditto. * gcc.dg/debug/ctf/ctf-array-5.c: Ditto. * gcc.dg/debug/ctf/ctf-array-6.c: Ditto. * gcc.dg/debug/ctf/ctf-attr-mode-1.c: Ditto. * gcc.dg/debug/ctf/ctf-attr-used-1.c: Ditto. * gcc.dg/debug/ctf/ctf-bitfields-1.c: Ditto. * gcc.dg/debug/ctf/ctf-bitfields-2.c: Ditto. * gcc.dg/debug/ctf/ctf-bitfields-3.c: Ditto. * gcc.dg/debug/ctf/ctf-bitfields-4.c: Ditto. * gcc.dg/debug/ctf/ctf-complex-1.c: Ditto. * gcc.dg/debug/ctf/ctf-cvr-quals-1.c: Ditto. * gcc.dg/debug/ctf/ctf-cvr-quals-2.c: Ditto. * gcc.dg/debug/ctf/ctf-cvr-quals-3.c: Ditto. * gcc.dg/debug/ctf/ctf-cvr-quals-4.c: Ditto. * gcc.dg/debug/ctf/ctf-enum-1.c: Ditto. * gcc.dg/debug/ctf/ctf-enum-2.c: Ditto. * gcc.dg/debug/ctf/ctf-file-scope-1.c: Ditto. * gcc.dg/debug/ctf/ctf-float-1.c: Ditto. * gcc.dg/debug/ctf/ctf-forward-1.c: Ditto. * gcc.dg/debug/ctf/ctf-forward-2.c: Ditto. * gcc.dg/debug/ctf/ctf-func-index-1.c: Ditto. * gcc.dg/debug/ctf/ctf-function-pointers-1.c: Ditto. * gcc.dg/debug/ctf/ctf-function-pointers-2.c: Ditto. * gcc.dg/debug/ctf/ctf-function-pointers-3.c: Ditto. * gcc.dg/debug/ctf/ctf-function-pointers-4.c: Ditto. * gcc.dg/debug/ctf/ctf-functions-1.c: Ditto. * gcc.dg/debug/ctf/ctf-int-1.c: Ditto. * gcc.dg/debug/ctf/ctf-objt-index-1.c: Ditto. * gcc.dg/debug/ctf/ctf-pointers-1.c: Ditto. * gcc.dg/debug/ctf/ctf-pointers-2.c: Ditto. * gcc.dg/debug/ctf/ctf-preamble-1.c: Ditto. * gcc.dg/debug/ctf/ctf-str-table-1.c: Ditto. * gcc.dg/debug/ctf/ctf-struct-1.c: Ditto. * gcc.dg/debug/ctf/ctf-struct-2.c: Ditto. * gcc.dg/debug/ctf/ctf-struct-array-1.c: Ditto. * gcc.dg/debug/ctf/ctf-struct-array-2.c: Ditto. * gcc.dg/debug/ctf/ctf-typedef-1.c: Ditto. * gcc.dg/debug/ctf/ctf-typedef-2.c: Ditto. * gcc.dg/debug/ctf/ctf-typedef-3.c: Ditto. * gcc.dg/debug/ctf/ctf-typedef-struct-1.c: Ditto. * gcc.dg/debug/ctf/ctf-typedef-struct-2.c: Ditto. * gcc.dg/debug/ctf/ctf-typedef-struct-3.c: Ditto. * gcc.dg/debug/ctf/ctf-union-1.c: Ditto. * gcc.dg/debug/ctf/ctf-variables-1.c: Ditto. * gcc.dg/debug/ctf/ctf-variables-2.c: Ditto. * gcc.dg/debug/ctf/ctf-variables-3.c: Ditto.
2024-09-19c-family: regenerate c.opt.urlsMarek Polacek1-0/+3
I forgot again. gcc/c-family/ChangeLog: * c.opt.urls: Regenerate.
2024-09-19c++: deleting explicitly-defaulted functions [PR116162]Marek Polacek22-40/+359
This PR points out the we're not implementing [dcl.fct.def.default] properly. Consider e.g. struct C { C(const C&&) = default; }; where we wrongly emit an error, but the move ctor should be just =deleted. According to [dcl.fct.def.default], if the type of the special member function differs from the type of the corresponding special member function that would have been implicitly declared in a way other than as allowed by 2.1-4, the function is defined as deleted. There's an exception for assignment operators in which case the program is ill-formed. clang++ has a warning for when we delete an explicitly-defaulted function so this patch adds it too. When the code is ill-formed, we emit an error in all modes. Otherwise, we emit a pedwarn in C++17 and a warning in C++20. PR c++/116162 gcc/c-family/ChangeLog: * c.opt (Wdefaulted-function-deleted): New. gcc/cp/ChangeLog: * class.cc (check_bases_and_members): Don't set DECL_DELETED_FN here, leave it to defaulted_late_check. * cp-tree.h (maybe_delete_defaulted_fn): Declare. (defaulted_late_check): Add a tristate parameter. * method.cc (maybe_delete_defaulted_fn): New. (defaulted_late_check): Add a tristate parameter. Call maybe_delete_defaulted_fn instead of giving an error. gcc/ChangeLog: * doc/invoke.texi: Document -Wdefaulted-function-deleted. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/defaulted15.C: Add dg-warning/dg-error. * g++.dg/cpp0x/defaulted51.C: Likewise. * g++.dg/cpp0x/defaulted52.C: Likewise. * g++.dg/cpp0x/defaulted53.C: Likewise. * g++.dg/cpp0x/defaulted54.C: Likewise. * g++.dg/cpp0x/defaulted56.C: Likewise. * g++.dg/cpp0x/defaulted57.C: Likewise. * g++.dg/cpp0x/defaulted58.C: Likewise. * g++.dg/cpp0x/defaulted59.C: Likewise. * g++.dg/cpp0x/defaulted63.C: New test. * g++.dg/cpp0x/defaulted64.C: New test. * g++.dg/cpp0x/defaulted65.C: New test. * g++.dg/cpp0x/defaulted66.C: New test. * g++.dg/cpp0x/defaulted67.C: New test. * g++.dg/cpp0x/defaulted68.C: New test. * g++.dg/cpp0x/defaulted69.C: New test. * g++.dg/cpp23/defaulted1.C: New test.
2024-09-19Update cpplib zh_CN.poJoseph Myers1-198/+121
* zh_CN.po: Update.
2024-09-19Update gcc zh_CN.poJoseph Myers1-280/+181
* zh_CN.po: Update.
2024-09-19dwarf2asm: Use constexpr for eh_data_format_name initialization for C++14Jakub Jelinek1-2/+17
Similarly to the previous patch, dwarf2asm.cc had HAVE_DESIGNATED_INITIALIZERS support, and as fallback a huge switch. The switch from what I can see is expanded as a jump table with 256 label pointers and code at those labels then loads addresses of string literals. The following patch instead uses a table with 256 const char * pointers, NULL for ICE, non-NULL for returning something, similarly to the HAVE_DESIGNATED_INITIALIZERS case. 2024-09-19 Jakub Jelinek <jakub@redhat.com> * dwarf2asm.cc (eh_data_format_name): Use constexpr initialization of format_names table for C++14 instead of a large switch.
2024-09-19RISC-V: Add testcases for form 2 of signed scalar SAT_ADDPan Li9-0/+199
This patch would like to add testcases of the signed scalar SAT_ADD for form 2. Aka: Form 2: #define DEF_SAT_S_ADD_FMT_2(T, UT, MIN, MAX) \ T __attribute__((noinline)) \ sat_s_add_##T##_fmt_2 (T x, T y) \ { \ T sum = (UT)x + (UT)y; \ if ((x ^ y) < 0 || (sum ^ x) >= 0) \ return sum; \ return x < 0 ? MIN : MAX; \ } DEF_SAT_S_ADD_FMT_2 (int64_t, uint64_t, INT64_MIN, INT64_MAX) The below test are passed for this patch. * The rv64gcv fully regression test. gcc/testsuite/ChangeLog: * gcc.target/riscv/sat_arith.h: Add test helper macros. * gcc.target/riscv/sat_s_add-5.c: New test. * gcc.target/riscv/sat_s_add-6.c: New test. * gcc.target/riscv/sat_s_add-7.c: New test. * gcc.target/riscv/sat_s_add-8.c: New test. * gcc.target/riscv/sat_s_add-run-5.c: New test. * gcc.target/riscv/sat_s_add-run-6.c: New test. * gcc.target/riscv/sat_s_add-run-7.c: New test. * gcc.target/riscv/sat_s_add-run-8.c: New test. Signed-off-by: Pan Li <pan2.li@intel.com>
2024-09-19tree-optimization/116768 - wrong dependence analysisRichard Biener3-4/+34
The following reverts a bogus fix done for PR101009 and instead makes sure we get into the same_access_functions () case when computing the distance vector for g[1] and g[1] where the constants ended up having different types. The generic code doesn't seem to handle loop invariant dependences. The special case gets us both ( 0 ) and ( 1 ) as distance vectors while formerly we got ( 1 ), which the PR101009 fix changed to ( 0 ) with bad effects on other cases as shown in this PR. PR tree-optimization/116768 * tree-data-ref.cc (build_classic_dist_vector_1): Revert PR101009 change. * tree-chrec.cc (eq_evolutions_p): Make sure (sizetype)1 and (int)1 compare equal. * gcc.dg/torture/pr116768.c: New testcase.
2024-09-19Fall back to single-lane SLP before falling back to no SLPRichard Biener4-42/+54
The following changes the fallback to disable SLP when any of the discovered SLP instances failed to pass vectorization checking into a fallback that emulates what no SLP would do with SLP - force single-lane discovery for all instances. The patch does not remove the final fallback to disable SLP but it reduces the fallout from failing vectorization when any non-SLP stmt survives analysis. * tree-vectorizer.h (vect_analyze_slp): Add force_single_lane parameter. * tree-vect-slp.cc (vect_analyze_slp_instance): Remove defaulting of force_single_lane. (vect_build_slp_instance): Likewise. Pass down appropriate force_single_lane. (vect_analyze_slp): Add force_sigle_lane parameter and pass it down appropriately. (vect_slp_analyze_bb_1): Always do multi-lane SLP. * tree-vect-loop.cc (vect_analyze_loop_2): Track two SLP modes and adjust accordingly. (vect_analyze_loop_1): Save the SLP mode when unrolling. * gcc.dg/vect/vect-outer-slp-1.c: Adjust.
2024-09-19libstdc++: add #pragma diagnosticJason Merrill72-7/+320
The use of #pragma GCC system_header in libstdc++ has led to bugs going undetected for a while due to the silencing of compiler warnings that would have revealed them promptly, and also interferes with warnings about problematic template instantiations induced by user code. But removing it, or even compiling with -Wsystem-header, is also problematic due to warnings about deliberate uses of extensions. So this patch adds #pragma GCC diagnostic as needed to suppress these warnings. The change to acinclude.m4 changes -Wabi to warn only in comparison to ABI 19, to avoid lots of warnings that we now mangle concept requirements, which are in any case still experimental. I checked for any other changes against ABI v15, and found only the <format> lambda mangling, which we can ignore. This also enables -Wsystem-headers while building the library, so we see any warnings not silenced by these #pragmas. libstdc++-v3/ChangeLog: * include/bits/algorithmfwd.h: * include/bits/allocator.h: * include/bits/codecvt.h: * include/bits/concept_check.h: * include/bits/cpp_type_traits.h: * include/bits/hashtable.h: * include/bits/iterator_concepts.h: * include/bits/ostream_insert.h: * include/bits/ranges_base.h: * include/bits/regex_automaton.h: * include/bits/std_abs.h: * include/bits/stl_algo.h: * include/c_compatibility/fenv.h: * include/c_compatibility/inttypes.h: * include/c_compatibility/stdint.h: * include/ext/concurrence.h: * include/ext/type_traits.h: * testsuite/ext/type_traits/add_unsigned_floating_neg.cc: * testsuite/ext/type_traits/add_unsigned_integer_neg.cc: * testsuite/ext/type_traits/remove_unsigned_floating_neg.cc: * testsuite/ext/type_traits/remove_unsigned_integer_neg.cc: * include/bits/basic_ios.tcc: * include/bits/basic_string.tcc: * include/bits/fstream.tcc: * include/bits/istream.tcc: * include/bits/locale_classes.tcc: * include/bits/locale_facets.tcc: * include/bits/ostream.tcc: * include/bits/regex_compiler.tcc: * include/bits/sstream.tcc: * include/bits/streambuf.tcc: * configure: Regenerate. * include/bits/c++config: * include/c/cassert: * include/c/cctype: * include/c/cerrno: * include/c/cfloat: * include/c/climits: * include/c/clocale: * include/c/cmath: * include/c/csetjmp: * include/c/csignal: * include/c/cstdarg: * include/c/cstddef: * include/c/cstdio: * include/c/cstdlib: * include/c/cstring: * include/c/ctime: * include/c/cwchar: * include/c/cwctype: * include/c_global/climits: * include/c_global/cmath: * include/c_global/cstddef: * include/c_global/cstdlib: * include/decimal/decimal: * include/ext/rope: * include/std/any: * include/std/charconv: * include/std/complex: * include/std/coroutine: * include/std/format: * include/std/iomanip: * include/std/limits: * include/std/numbers: * include/tr1/functional: * include/tr1/tuple: * include/tr1/type_traits: * libsupc++/compare: * libsupc++/new: Add #pragma GCC diagnostic to suppress undesired warnings. * acinclude.m4: Change -Wabi version from 2 to 19. gcc/ChangeLog: * ginclude/stdint-wrap.h: Add #pragma GCC diagnostic to suppress undesired warnings. * gsyslimits.h: Likewise.
2024-09-19Always dump generated distance vectorsRichard Biener1-16/+18
There's special-casing for equal access functions which bypasses printing the distance vectors. The following makes sure we print them always which helps debugging. * tree-data-ref.cc (build_classic_dist_vector): Move distance vector dumping to single caller ... (subscript_dependence_tester): ... here, dumping always when we succeed computing it.
2024-09-19tree-optimization/116573 - .SELECT_VL for SLPRichard Biener2-5/+20
The following restores the use of .SELECT_VL for testcases where it is safe to use even when using SLP. I've for now restricted it to single-lane SLP plus optimistically allow store-lane nodes and assume single-lane roots are not widened but at most to load-lane who should be fine. PR tree-optimization/116573 * tree-vect-loop.cc (vect_analyze_loop_2): Allow .SELECV_VL for SLP but disable it when there's multi-lane instances. * tree-vect-stmts.cc (vectorizable_store): Only compute the ptr increment when generating code. (vectorizable_load): Likewise.
2024-09-19Fortran: Break recursion building recursive types. [PR106606]Andre Vehreschild2-6/+51
Build a derived type component's type only, when it is not already being built and the component uses pointer semantics. gcc/fortran/ChangeLog: PR fortran/106606 * trans-types.cc (gfc_get_derived_type): Only build non-pointer derived types as component's types when they are not yet built. gcc/testsuite/ChangeLog: * gfortran.dg/recursive_alloc_comp_5.f90: New test.
2024-09-19RISC-V: Fix vector SAT_ADD dump check due to middle-end changePan Li16-16/+16
This patch would like fix the dump check times of vector SAT_ADD. The middle-end change makes the match times from 2 to 4 times. The below test suites are passed for this patch. * The rv64gcv fully regression test. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add-21.c: Adjust the dump check times from 2 to 4. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add-22.c: Ditto. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add-23.c: Ditto. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add-24.c: Ditto. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add-25.c: Ditto. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add-26.c: Ditto. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add-27.c: Ditto. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add-28.c: Ditto. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add-29.c: Ditto. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add-30.c: Ditto. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add-31.c: Ditto. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add-32.c: Ditto. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add-5.c: Ditto. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add-6.c: Ditto. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add-7.c: Ditto. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add-8.c: Ditto. Signed-off-by: Pan Li <pan2.li@intel.com>
2024-09-19Match: Support form 3 for scalar signed integer .SAT_ADDPan Li1-0/+10
This patch would like to support the form 3 of the scalar signed integer .SAT_ADD. Aka below example: Form 3: #define DEF_SAT_S_ADD_FMT_3(T, UT, MIN, MAX) \ T __attribute__((noinline)) \ sat_s_add_##T##_fmt_3 (T x, T y) \ { \ T sum; \ bool overflow = __builtin_add_overflow (x, y, &sum); \ return overflow ? x < 0 ? MIN : MAX : sum; \ } DEF_SAT_S_ADD_FMT_3(int8_t, uint8_t, INT8_MIN, INT8_MAX) We can tell the difference before and after this patch if backend implemented the ssadd<m>3 pattern similar as below. Before this patch: 4 │ __attribute__((noinline)) 5 │ int8_t sat_s_add_int8_t_fmt_3 (int8_t x, int8_t y) 6 │ { 7 │ signed char _1; 8 │ signed char _2; 9 │ int8_t _3; 10 │ __complex__ signed char _6; 11 │ _Bool _8; 12 │ signed char _9; 13 │ signed char _10; 14 │ signed char _11; 15 │ 16 │ ;; basic block 2, loop depth 0 17 │ ;; pred: ENTRY 18 │ _6 = .ADD_OVERFLOW (x_4(D), y_5(D)); 19 │ _2 = IMAGPART_EXPR <_6>; 20 │ if (_2 != 0) 21 │ goto <bb 4>; [50.00%] 22 │ else 23 │ goto <bb 3>; [50.00%] 24 │ ;; succ: 4 25 │ ;; 3 26 │ 27 │ ;; basic block 3, loop depth 0 28 │ ;; pred: 2 29 │ _1 = REALPART_EXPR <_6>; 30 │ goto <bb 5>; [100.00%] 31 │ ;; succ: 5 32 │ 33 │ ;; basic block 4, loop depth 0 34 │ ;; pred: 2 35 │ _8 = x_4(D) < 0; 36 │ _9 = (signed char) _8; 37 │ _10 = -_9; 38 │ _11 = _10 ^ 127; 39 │ ;; succ: 5 40 │ 41 │ ;; basic block 5, loop depth 0 42 │ ;; pred: 3 43 │ ;; 4 44 │ # _3 = PHI <_1(3), _11(4)> 45 │ return _3; 46 │ ;; succ: EXIT 47 │ 48 │ } After this patch: 4 │ __attribute__((noinline)) 5 │ int8_t sat_s_add_int8_t_fmt_3 (int8_t x, int8_t y) 6 │ { 7 │ int8_t _3; 8 │ 9 │ ;; basic block 2, loop depth 0 10 │ ;; pred: ENTRY 11 │ _3 = .SAT_ADD (x_4(D), y_5(D)); [tail call] 12 │ return _3; 13 │ ;; succ: EXIT 14 │ 15 │ } The below test suites are passed for this patch. * The rv64gcv fully regression test. * The x86 bootstrap test. * The x86 fully regression test. gcc/ChangeLog: * match.pd: Add the form 3 of signed .SAT_ADD matching. Signed-off-by: Pan Li <pan2.li@intel.com>
2024-09-19Genmatch: Refine the gen_phi_on_cond by match_cond_with_binary_phiPan Li1-52/+14
This patch would like to leverage the match_cond_with_binary_phi to match the phi on cond, and get the true/false arg if matched. This helps a lot to simplify the implementation of gen_phi_on_cond. Before this patch: basic_block _b1 = gimple_bb (_a1); if (gimple_phi_num_args (_a1) == 2) { basic_block _pb_0_1 = EDGE_PRED (_b1, 0)->src; basic_block _pb_1_1 = EDGE_PRED (_b1, 1)->src; basic_block _db_1 = safe_dyn_cast <gcond *> (*gsi_last_bb (_pb_0_1)) ? _pb_0_1 : _pb_1_1; basic_block _other_db_1 = safe_dyn_cast <gcond *> (*gsi_last_bb (_pb_0_1)) ? _pb_1_1 : _pb_0_1; gcond *_ct_1 = safe_dyn_cast <gcond *> (*gsi_last_bb (_db_1)); if (_ct_1 && EDGE_COUNT (_other_db_1->preds) == 1 && EDGE_COUNT (_other_db_1->succs) == 1 && EDGE_PRED (_other_db_1, 0)->src == _db_1) { tree _cond_lhs_1 = gimple_cond_lhs (_ct_1); tree _cond_rhs_1 = gimple_cond_rhs (_ct_1); tree _p0 = build2 (gimple_cond_code (_ct_1), boolean_type_node, _cond_lhs_1, _cond_rhs_1); bool _arg_0_is_true_1 = gimple_phi_arg_edge (_a1, 0)->flags & EDGE_TRUE_VALUE; tree _p1 = gimple_phi_arg_def (_a1, _arg_0_is_true_1 ? 0 : 1); tree _p2 = gimple_phi_arg_def (_a1, _arg_0_is_true_1 ? 1 : 0); ... After this patch: basic_block _b1 = gimple_bb (_a1); tree _p1, _p2; gcond *_cond_1 = match_cond_with_binary_phi (_a1, &_p1, &_p2); if (_cond_1) { tree _cond_lhs_1 = gimple_cond_lhs (_cond_1); tree _cond_rhs_1 = gimple_cond_rhs (_cond_1); tree _p0 = build2 (gimple_cond_code (_cond_1), boolean_type_node, _cond_lhs_1, _cond_rhs_1); ... The below test suites are passed for this patch. * The rv64gcv fully regression test. * The x86 bootstrap test. * The x86 fully regression test. gcc/ChangeLog: * genmatch.cc (dt_operand::gen_phi_on_cond): Leverage the match_cond_with_binary_phi API to get cond gimple, true and false TREE arg. Signed-off-by: Pan Li <pan2.li@intel.com>
2024-09-19Fix deep copy allocatable components in coarrays. [PR85002]Andre Vehreschild3-9/+32
Fix code for deep copy of allocatable components in derived type nested structures generated, but not inserted when the copy had to be done in a coarray. Additionally fix a comment. gcc/fortran/ChangeLog: PR fortran/85002 * trans-array.cc (duplicate_allocatable_coarray): Allow adding of deep copy code in the when-allocated case. Add bounds computation before condition, because coarrays need the bounds also when not allocated. (structure_alloc_comps): Duplication in the coarray case is done already, omit it. Add the deep-code when duplication a coarray. * trans-expr.cc (gfc_trans_structure_assign): Fix comment. gcc/testsuite/ChangeLog: * gfortran.dg/coarray/alloc_comp_9.f90: New test.
2024-09-19SVE intrinsics: Fold svmul with all-zero operands to zero vectorJennifer Schmitz3-3/+383
As recently implemented for svdiv, this patch folds svmul to a zero vector if one of the operands is a zero vector. This transformation is applied if at least one of the following conditions is met: - the first operand is all zeros or - the second operand is all zeros, and the predicate is ptrue or the predication is _x or _z. In contrast to constant folding, which was implemented in a previous patch, this transformation is applied as soon as one of the operands is a zero vector, while the other operand can be a variable. The patch was bootstrapped and regtested on aarch64-linux-gnu, no regression. OK for mainline? Signed-off-by: Jennifer Schmitz <jschmitz@nvidia.com> gcc/ * config/aarch64/aarch64-sve-builtins-base.cc (svmul_impl::fold): Add folding of all-zero operands to zero vector. gcc/testsuite/ * gcc.target/aarch64/sve/const_fold_mul_1.c: Adjust expected outcome. * gcc.target/aarch64/sve/fold_mul_zero.c: New test.
2024-09-19aarch64: Define l1_cache_line_size for -mcpu=neoverse-v2Kyrylo Tkachov1-1/+14
This is a small patch that sets the L1 cache line size for Neoverse V2. Unlike the other cache-related constants in there this value is not used just for SW prefetch generation (which we want to avoid for Neoverse V2 presently). It's also used to set std::hardware_destructive_interference_size. See the links and recent discussions in PR116662 for reference. Some CPU tunings in aarch64 set this value to something useful, but for generic tuning we use the conservative 256, which forces 256-byte alignment in such atomic structures. Using a smaller value can decrease the size of such structs during layout and should not present an ABI problem as std::hardware_destructive_interference_size is not intended to be used for structs in an external interface, and GCC warns about such uses. Another place where the L1 cache line size is used is in phiopt for -fhoist-adjacent-loads where conditional accesses to adjacent struct members can be speculatively loaded as long as they are within the same L1 cache line. e.g. struct S { int i; int j; }; int bar (struct S *x, int y) { int r; if (y) r = x->i; else r = x->j; return r; } The Neoverse V2 L1 cache line is 64 bytes according to the TRM, so set it to that. The rest of the prefetch parameters inherit from the generic tuning so we don't do anything extra for software prefeteches. Bootstrapped and tested on aarch64-none-linux-gnu. Signed-off-by: Kyrylo Tkachov <ktkachov@nvidia.com> * config/aarch64/tuning_models/neoversev2.h (neoversev2_prefetch_tune): Define. (neoversev2_tunings): Use it.