- Sep 10, 2024
-
-
Piotr Trojanek authored
When semantic checking mode is active, i.e. when switch -gnatc is present or when the frontend is operating in the GNATprove mode, we now rewrite calls to GNAT.Source_Info routines in evaluation and not expansion (which is disabled in these modes). This is needed to recognize constants initialized with calls to GNAT.Source_Info as static constants, regardless of expansion being enabled. gcc/ada/ * exp_intr.ads, exp_intr.adb (Expand_Source_Info): Move declaration to package spec. * sem_eval.adb (Eval_Intrinsic_Call): Evaluate calls to GNAT.Source_Info where possible.
-
Piotr Trojanek authored
Code cleanup; semantics is unaffected. gcc/ada/ * checks.adb (Remove_Checks): Combine CASE alternatives.
-
Piotr Trojanek authored
Code cleanup. gcc/ada/ * libgnat/s-os_lib.ads: Remove extra whitespace.
-
Levy Hsu authored
gcc/testsuite/ChangeLog: * gcc.target/i386/avx10_2-partial-bf-vector-fma-1.c: Separated 32-bit scan and removed register checks in spill situations.
-
Andrew Pinski authored
When r14-303-gb9fedabe381cce was done, it was missed that some of the common parts could be done in a template and a lambda could be used. This patch implements that. This new function can be used later on to implement a simple ifcvt pass. gcc/ChangeLog: * tree-ssa-phiopt.cc (execute_over_cond_phis): New template function, moved the common parts from pass_phiopt::execute/pass_cselim::execute. (pass_phiopt::execute): Move the functon specific parts of the loop into an lamdba. (pass_cselim::execute): Likewise. Signed-off-by:
Andrew Pinski <quic_apinski@quicinc.com>
-
Andrew Pinski authored
This converts the uses of PHI_RESULT in phiopt to be gimple_phi_result instead. Since there was already a mismatch of uses here, it would be good to use prefered one (gimple_phi_result) instead. Bootstrapped and tested on x86_64-linux-gnu. PR tree-optimization/116643 gcc/ChangeLog: * tree-ssa-phiopt.cc (replace_phi_edge_with_variable): s/PHI_RESULT/gimple_phi_result/. (factor_out_conditional_operation): Likewise. (minmax_replacement): Likewise. (spaceship_replacement): Likewise. (cond_store_replacement): Likewise. (cond_if_else_store_replacement_1): Likewise. Signed-off-by:
Andrew Pinski <quic_apinski@quicinc.com>
-
liuhongt authored
It fix the regression by a51f2fc0 is the first bad commit commit a51f2fc0 Author: liuhongt <hongtao.liu@intel.com> Date: Wed Sep 4 15:39:17 2024 +0800 Handle const0_operand for *avx2_pcmp<mode>3_1. caused FAIL: gcc.target/i386/pr59539-1.c scan-assembler-times vmovdqu|vmovups 1 To reproduce: $ cd {build_dir}/gcc && make check RUNTESTFLAGS="i386.exp=gcc.target/i386/pr59539-1.c --target_board='unix{-m32\ -march=cascadelake}'" $ cd {build_dir}/gcc && make check RUNTESTFLAGS="i386.exp=gcc.target/i386/pr59539-1.c --target_board='unix{-m64\ -march=cascadelake}'" gcc/ChangeLog: * config/i386/sse.md (*avx2_pcmp<mode>3_1): Don't force_reg operands[3] when it's not const0_rtx.
-
GCC Administrator authored
-
- Sep 09, 2024
-
-
David Malcolm authored
Use a new struct diagnostic_option_id rather than just "int" when referring to command-line options controlling warnings in the diagnostic subsystem. No functional change intended, but better documents the meaning of the code. gcc/c-family/ChangeLog: * c-common.cc (c_option_controlling_cpp_diagnostic): Return diagnostic_option_id rather than int. (c_cpp_diagnostic): Update for renaming of diagnostic_override_option_index to diagnostic_set_option_id. gcc/c/ChangeLog: * c-errors.cc (pedwarn_c23): Use "diagnostic_option_id option_id" rather than "int opt". Update for renaming of diagnostic_info field. (pedwarn_c11): Likewise. (pedwarn_c99): Likewise. (pedwarn_c90): Likewise. * c-tree.h (pedwarn_c90): Likewise for decl. (pedwarn_c99): Likewise. (pedwarn_c11): Likewise. (pedwarn_c23): Likewise. gcc/cp/ChangeLog: * constexpr.cc (constexpr_error): Update for renaming of diagnostic_info field. * cp-tree.h (pedwarn_cxx98): Use "diagnostic_option_id" rather than "int". * error.cc (cp_adjust_diagnostic_info): Update for renaming of diagnostic_info field. (pedwarn_cxx98): Use "diagnostic_option_id option_id" rather than "int opt". Update for renaming of diagnostic_info field. (diagnostic_set_info): Likewise. gcc/d/ChangeLog: * d-diagnostic.cc (d_diagnostic_report_diagnostic): Update for renaming of diagnostic_info field. gcc/ChangeLog: * diagnostic-core.h (struct diagnostic_option_id): New. (warning): Use it rather than "int" for param. (warning_n): Likewise. (warning_at): Likewise. (warning_meta): Likewise. (pedwarn): Likewise. (permerror_opt): Likewise. (emit_diagnostic): Likewise. (emit_diagnostic_valist): Likewise. (emit_diagnostic_valist_meta): Likewise. * diagnostic-format-json.cc (json_output_format::on_report_diagnostic): Update for renaming of diagnostic_info field. * diagnostic-format-sarif.cc (sarif_builder::make_result_object): Likewise. (make_reporting_descriptor_object_for_warning): Likewise. * diagnostic-format-text.cc (print_option_information): Likewise. * diagnostic-global-context.cc (emit_diagnostic): Use "diagnostic_option_id option_id" rather than "int opt". (emit_diagnostic_valist): Likewise. (emit_diagnostic_valist_meta): Likewise. (warning): Likewise. (warning_at): Likewise. (warning_meta): Likewise. (warning_n): Likewise. (pedwarn): Likewise. (permerror_opt): Likewise. * diagnostic.cc (diagnostic_set_info_translated): Update for renaming of diagnostic_info field. (diagnostic_option_classifier::classify_diagnostic): Use "diagnostic_option_id option_id" rather than "int opt". (update_effective_level_from_pragmas): Update for renaming of diagnostic_info field. (diagnostic_context::diagnostic_enabled): Likewise. (diagnostic_context::warning_enabled_at): Use "diagnostic_option_id option_id" rather than "int opt". (diagnostic_context::diagnostic_impl): Likewise. (diagnostic_context::diagnostic_n_impl): Likewise. * diagnostic.h (diagnostic_info::diagnostic_info): Update for... (diagnostic_info::option_index): Rename... (diagnostic_info::option_id): ...to this. (class diagnostic_option_manager): Use "diagnostic_option_id option_id" rather than "int opt" for vfuncs. (diagnostic_option_classifier): Likewise for member funcs. (diagnostic_classification_change_t::option): Add comment. (diagnostic_context::warning_enabled_at): Use "diagnostic_option_id option_id" rather than "int option_index". (diagnostic_context::option_unspecified_p): Likewise. (diagnostic_context::classify_diagnostic): Likewise. (diagnostic_context::option_enabled_p): Likewise. (diagnostic_context::make_option_name): Likewise. (diagnostic_context::make_option_url): Likewise. (diagnostic_context::diagnostic_impl): Likewise. (diagnostic_context::diagnostic_n_impl): Likewise. (diagnostic_override_option_index): Rename... (diagnostic_set_option_id): ...to this, and update for diagnostic_info field renaming. (diagnostic_classify_diagnostic): Use "diagnostic_option_id" rather than "int". (warning_enabled_at): Likewise. (option_unspecified_p): Likewise. gcc/fortran/ChangeLog: * cpp.cc (cb_cpp_diagnostic_cpp_option): Convert return type from "int" to "diagnostic_option_id". (cb_cpp_diagnostic): Update for renaming of diagnostic_override_option_index to diagnostic_set_option_id. * error.cc (gfc_warning): Update for renaming of diagnostic_info field. (gfc_warning_now_at): Likewise. (gfc_warning_now): Likewise. (gfc_warning_internal): Likewise. gcc/ChangeLog: * ipa-pure-const.cc: Replace include of "opts.h" with "opts-diagnostic.h". (suggest_attribute): Convert param from int to diagnostic_option_id. * lto-wrapper.cc (class lto_diagnostic_option_manager): Use diagnostic_option_id rather than "int". * opts-common.cc (compiler_diagnostic_option_manager::option_enabled_p): Likewise. * opts-diagnostic.h (class gcc_diagnostic_option_manager): Likewise. (class compiler_diagnostic_option_manager): Likewise. * opts.cc (compiler_diagnostic_option_manager::make_option_name): Likewise. (gcc_diagnostic_option_manager::make_option_url): Likewise. * substring-locations.cc (format_string_diagnostic_t::emit_warning_n_va): Likewise. (format_string_diagnostic_t::emit_warning_va): Likewise. (format_string_diagnostic_t::emit_warning): Likewise. (format_string_diagnostic_t::emit_warning_n): Likewise. * substring-locations.h (format_string_diagnostic_t::emit_warning_va): Likewise. (format_string_diagnostic_t::emit_warning_n_va): Likewise. (format_string_diagnostic_t::emit_warning): Likewise. (format_string_diagnostic_t::emit_warning_n): Likewise. Signed-off-by:
David Malcolm <dmalcolm@redhat.com>
-
David Malcolm authored
Introduce a diagnostic_option_manager class to help isolate the diagnostics subsystem from GCC's option handling. No functional change intended. gcc/ChangeLog: * diagnostic.cc (diagnostic_context::initialize): Replace m_options_callbacks with m_option_mgr. (diagnostic_context::set_option_hooks): Replace with... (diagnostic_context::set_option_manager): ...this. * diagnostic.h (diagnostic_option_enabled_cb): Delete. (diagnostic_make_option_name_cb): Delete. (diagnostic_make_option_url_cb): Delete. (class diagnostic_option_manager): New. (diagnostic_manager::option_enabled_p): Convert from using m_option_callbacks to m_option_mgr. (diagnostic_manager::make_option_name): Likewise. (diagnostic_manager::make_option_url): Likewise. (diagnostic_manager::set_option_hooks): Replace with... (diagnostic_manager::set_option_manager): ...this. (diagnostic_manager::get_lang_mask): Update for field changes. (diagnostic_manager::m_option_callbacks): Replace with... (diagnostic_manager::m_option_mgr): ...this and... (diagnostic_manager::m_lang_mask): ...this. * lto-wrapper.cc (class lto_diagnostic_option_manager): New. (main): Port from option hooks to diagnostic_option_manager. * opts-common.cc: Include "opts-diagnostic.h". (compiler_diagnostic_option_manager::option_enabled_p): New. * opts-diagnostic.h (option_name): Drop decl. (get_option_url): Drop decl. (class gcc_diagnostic_option_manager): New. (class compiler_diagnostic_option_manager): New. * opts.cc (option_name): Convert to... (compiler_diagnostic_option_manager::make_option_name): ...this. (get_option_url): Convert to... (gcc_diagnostic_option_manager::make_option_url): ...this. * toplev.cc (general_init): Port from option hooks to diagnostic_option_manager. Signed-off-by:
David Malcolm <dmalcolm@redhat.com>
-
David Malcolm authored
Rename diagnostic_context's "printer" field to "m_printer", for consistency with other fields, and to highlight places where we currently use this, to help assess feasibility of supporting multiple output sinks (PR other/116613). No functional change intended. gcc/ChangeLog: PR other/116613 * attribs.cc (decls_mismatched_attributes): Rename diagnostic_context's "printer" field to "m_printer". (attr_access::array_as_string): Likewise. * diagnostic-format-json.cc (json_output_format::on_report_diagnostic): Likewise. (diagnostic_output_format_init_json): Likewise. * diagnostic-format-sarif.cc (sarif_result::on_nested_diagnostic): Likewise. (sarif_ice_notification): Likewise. (sarif_builder::on_report_diagnostic): Likewise. (sarif_builder::make_result_object): Likewise. (sarif_builder::make_location_object): Likewise. (sarif_builder::make_message_object_for_diagram): Likewise. (diagnostic_output_format_init_sarif): Likewise. * diagnostic-format-text.cc (diagnostic_text_output_format::~diagnostic_text_output_format): Likewise. (diagnostic_text_output_format::on_report_diagnostic): Likewise. (diagnostic_text_output_format::on_diagram): Likewise. (diagnostic_text_output_format::print_any_cwe): Likewise. (diagnostic_text_output_format::print_any_rules): Likewise. (diagnostic_text_output_format::print_option_information): Likewise. * diagnostic-format.h (diagnostic_output_format::get_printer): New. * diagnostic-global-context.cc (verbatim): Rename diagnostic_context's "printer" field to "m_printer". * diagnostic-path.cc (path_label::get_text): Likewise. (print_path_summary_as_text): Likewise. (diagnostic_context::print_path): Likewise. (selftest::test_empty_path): Likewise. (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. (assert_cfg_edge_path_streq): Likewise. (selftest::test_control_flow_5): Likewise. (selftest::test_control_flow_6): Likewise. * diagnostic-show-locus.cc (layout::layout): Likewise. (selftest::test_layout_x_offset_display_utf8): Likewise. (selftest::test_layout_x_offset_display_tab): Likewise. (selftest::test_diagnostic_show_locus_unknown_location): Likewise. (selftest::test_one_liner_simple_caret): Likewise. (selftest::test_one_liner_no_column): Likewise. (selftest::test_one_liner_caret_and_range): Likewise. (selftest::test_one_liner_multiple_carets_and_ranges): Likewise. (selftest::test_one_liner_fixit_insert_before): Likewise. (selftest::test_one_liner_fixit_insert_after): Likewise. (selftest::test_one_liner_fixit_remove): Likewise. (selftest::test_one_liner_fixit_replace): Likewise. (selftest::test_one_liner_fixit_replace_non_equal_range): Likewise. (selftest::test_one_liner_fixit_replace_equal_secondary_range): Likewise. (selftest::test_one_liner_fixit_validation_adhoc_locations): Likewise. (selftest::test_one_liner_many_fixits_1): Likewise. (selftest::test_one_liner_many_fixits_2): Likewise. (selftest::test_one_liner_labels): Likewise. (selftest::test_one_liner_simple_caret_utf8): Likewise. (selftest::test_one_liner_caret_and_range_utf8): Likewise. (selftest::test_one_liner_multiple_carets_and_ranges_utf8): Likewise. (selftest::test_one_liner_fixit_insert_before_utf8): Likewise. (selftest::test_one_liner_fixit_insert_after_utf8): Likewise. (selftest::test_one_liner_fixit_remove_utf8): Likewise. (selftest::test_one_liner_fixit_replace_utf8): Likewise. (selftest::test_one_liner_fixit_replace_non_equal_range_utf8): Likewise. (selftest::test_one_liner_fixit_replace_equal_secondary_range_utf8): Likewise. (selftest::test_one_liner_fixit_validation_adhoc_locations_utf8): Likewise. (selftest::test_one_liner_many_fixits_1_utf8): Likewise. (selftest::test_one_liner_many_fixits_2_utf8): Likewise. (selftest::test_one_liner_labels_utf8): Likewise. (selftest::test_one_liner_colorized_utf8): Likewise. (selftest::test_add_location_if_nearby): Likewise. (selftest::test_diagnostic_show_locus_fixit_lines): Likewise. (selftest::test_overlapped_fixit_printing): Likewise. (selftest::test_overlapped_fixit_printing_utf8): Likewise. (selftest::test_overlapped_fixit_printing_2): Likewise. (selftest::test_fixit_insert_containing_newline): Likewise. (selftest::test_fixit_insert_containing_newline_2): Likewise. (selftest::test_fixit_replace_containing_newline): Likewise. (selftest::test_fixit_deletion_affecting_newline): Likewise. (selftest::test_tab_expansion): Likewise. (selftest::test_escaping_bytes_1): Likewise. (selftest::test_escaping_bytes_2): Likewise. (selftest::test_line_numbers_multiline_range): Likewise. * diagnostic.cc (file_name_as_prefix): Likewise. (diagnostic_set_caret_max_width): Likewise. (diagnostic_context::initialize): Likewise. (diagnostic_context::color_init): Likewise. (diagnostic_context::urls_init): Likewise. (diagnostic_context::finish): Likewise. (diagnostic_context::get_location_text): Likewise. (diagnostic_build_prefix): Likewise. (diagnostic_context::report_current_module): Likewise. (default_diagnostic_starter): Likewise. (default_diagnostic_start_span_fn): Likewise. (default_diagnostic_finalizer): Likewise. (diagnostic_context::report_diagnostic): Likewise. (diagnostic_append_note): Likewise. (diagnostic_context::error_recursion): Likewise. (fancy_abort): Likewise. * diagnostic.h (diagnostic_context::set_show_highlight_colors): Likewise. (diagnostic_context::printer): Rename to... (diagnostic_context::m_printer): ...this. (diagnostic_format_decoder): Rename diagnostic_context's "printer" field to "m_printer". (diagnostic_prefixing_rule): Likewise. (diagnostic_ready_p): Likewise. * gimple-ssa-warn-access.cc (pass_waccess::maybe_warn_memmodel): Likewise. * langhooks.cc (lhd_print_error_function): Likewise. * lto-wrapper.cc (print_lto_docs_link): Likewise. * opts-global.cc (init_options_once): Likewise. * opts.cc (common_handle_option): Likewise. * simple-diagnostic-path.cc (simple_diagnostic_path_cc_tests): Likewise. * text-art/dump.h (dump_to_file<T>): Likewise. * toplev.cc (announce_function): Likewise. (toplev::main): Likewise. * tree-diagnostic.cc (default_tree_diagnostic_starter): Likewise. * tree.cc (escaped_string::escape): Likewise. (selftest::test_escaped_strings): Likewise. gcc/ada/ChangeLog: PR other/116613 * gcc-interface/misc.cc (internal_error_function): Rename diagnostic_context's "printer" field to "m_printer". gcc/analyzer/ChangeLog: PR other/116613 * access-diagram.cc (access_range::dump): Rename diagnostic_context's "printer" field to "m_printer". * analyzer-language.cc (on_finish_translation_unit): Likewise. * analyzer.cc (make_label_text): Likewise. (make_label_text_n): Likewise. * 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. * diagnostic-manager.cc (diagnostic_manager::emit_saved_diagnostic): Likewise. * engine.cc (exploded_node::dump): Likewise. (exploded_path::dump): Likewise. (run_checkers): Likewise. * kf-analyzer.cc (kf_analyzer_dump_escaped::impl_call_pre): Likewise. * pending-diagnostic.cc (evdesc::event_desc::formatted_print): Likewise. * program-point.cc (function_point::print_source_line): Likewise. (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. * 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. (sufficiently_similar_p): Likewise. * store.cc (uncertainty_t::dump): Likewise. (binding_key::dump): Likewise. (binding_map::dump): Likewise. (binding_cluster::dump): Likewise. (store::dump): Likewise. * supergraph.cc (supergraph::dump_dot_to_file): Likewise. (superedge::dump): Likewise. * svalue.cc (svalue::dump): Likewise. gcc/c-family/ChangeLog: PR other/116613 * c-format.cc (selftest::test_type_mismatch_range_labels): Rename diagnostic_context's "printer" field to "m_printer". (selftest::test_type_mismatch_range_labels): Likewise. * c-opts.cc (c_diagnostic_finalizer): Likewise. gcc/c/ChangeLog: PR other/116613 * c-objc-common.cc (c_initialize_diagnostics): Rename diagnostic_context's "printer" field to "m_printer". gcc/cp/ChangeLog: PR other/116613 * error.cc (cxx_initialize_diagnostics): Rename diagnostic_context's "printer" field to "m_printer". (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_print_error_function): Likewise. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context_line): 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. * module.cc (noisy_p): Likewise. gcc/d/ChangeLog: PR other/116613 * d-diagnostic.cc (d_diagnostic_report_diagnostic): Rename diagnostic_context's "printer" field to "m_printer". gcc/fortran/ChangeLog: PR other/116613 * error.cc (gfc_clear_pp_buffer): Rename diagnostic_context's "printer" field to "m_printer". (gfc_warning): Likewise. (gfc_diagnostic_build_kind_prefix): Likewise. (gfc_diagnostic_build_locus_prefix): Likewise. (gfc_diagnostic_starter): Likewise. (gfc_diagnostic_starter): Likewise. (gfc_diagnostic_start_span): Likewise. (gfc_diagnostic_finalizer): Likewise. (gfc_warning_check): Likewise. (gfc_error_opt): Likewise. (gfc_error_check): Likewise. gcc/jit/ChangeLog: PR other/116613 * jit-playback.cc (add_diagnostic): Rename diagnostic_context's "printer" field to "m_printer". gcc/testsuite/ChangeLog: PR other/116613 * gcc.dg/plugin/analyzer_cpython_plugin.c (dump_refcnt_info): Update for renaming of field "printer" to "m_printer". * gcc.dg/plugin/diagnostic_group_plugin.c (test_diagnostic_starter): Likewise. (test_diagnostic_start_span_fn): Likewise. (test_output_format::on_begin_group): Likewise. (test_output_format::on_end_group): Likewise. * gcc.dg/plugin/diagnostic_plugin_test_paths.c: Likewise. * gcc.dg/plugin/diagnostic_plugin_test_show_locus.c (custom_diagnostic_finalizer): Likewise. Signed-off-by:
David Malcolm <dmalcolm@redhat.com>
-
David Malcolm authored
We were using https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json as the URL for the SARIF 2.1 schema, but this is now a 404. Update it to the URL listed in the spec (§3.13.3 "$schema property"), which is: https://docs.oasis-open.org/sarif/sarif/v2.1.0/errata01/os/schemas/sarif-schema-2.1.0.json and update the copy in gcc/testsuite/lib/sarif-schema-2.1.0.json used by the "verify-sarif-file" DejaGnu directive to the version found at that latter URL; the sha256 sum changes from: 2b19d2358baef0251d7d24e208d05ffabf1b2a3ab5e1b3a816066fc57fd4a7e8 to: c3b4bb2d6093897483348925aaa73af03b3e3f4bd4ca38cef26dcb4212a2682e Doing so added a validation error on c-c++-common/diagnostic-format-sarif-file-pr111700.c for which we emit this textual output: this-file-does-not-exist.c: warning: #warning message [-Wcpp] with no line number, and these invalid SARIF regions within the physical location of the warning: "region": {"startColumn": 2, "endColumn": 9}, "contextRegion": {} This is due to this directive: # 0 "this-file-does-not-exist.c" with line number 0. The patch fixes this by not creating regions that have startLine <= 0. gcc/ChangeLog: PR other/116603 * diagnostic-format-sarif.cc (SARIF_SCHEMA): Update URL. (sarif_builder::maybe_make_region_object): Don't create regions with startLine <= 0. (sarif_builder::maybe_make_region_object_for_context): Likewise. gcc/testsuite/ChangeLog: PR other/116603 * gcc.dg/plugin/diagnostic-test-metadata-sarif.py (test_basics): Update expected schema URL. * gcc.dg/plugin/diagnostic-test-paths-multithreaded-sarif.py: Likewise. * gcc.dg/sarif-output/test-include-chain-1.py: Likewise. * gcc.dg/sarif-output/test-include-chain-2.py: Likewise. * gcc.dg/sarif-output/test-missing-semicolon.py: Likewise. * gcc.dg/sarif-output/test-no-diagnostics.py: Likewise. * gcc.dg/sarif-output/test-werror.py: Likewise. * lib/sarif-schema-2.1.0.json: Update with copy downloaded from https://docs.oasis-open.org/sarif/sarif/v2.1.0/errata01/os/schemas/sarif-schema-2.1.0.json Signed-off-by:
David Malcolm <dmalcolm@redhat.com>
-
Uros Bizjak authored
Double-word memory operands are accessed as their high and low part, so the memory location has to be offsettable. Use "o" constraint instead of "m" for double-word memory operands. gcc/ChangeLog: * config/i386/i386.md (*insvdi_lowpart_1): Use "o" constraint instead of "m" for double-word mode memory operands. (*add<dwi>3_doubleword_zext): Ditto. (*addv<dwi>4_doubleword_1): Use "jO" constraint instead of "jM" for double-word mode memory operands.
-
David Malcolm authored
I missed this in r15-1108-g70f26314b62e2d. gcc/analyzer/ChangeLog: * call-summary.cc (call_summary_replay::convert_region_from_summary_1): Drop unused local "summary_cast_reg" Signed-off-by:
David Malcolm <dmalcolm@redhat.com>
-
Andrew Pinski authored
This expands on optimizing `popcount(a) == 1` to also handle `popcount(a) <= 1`. `<= 1` can be expanded as `(a & -a) == 0` like what is done for `== 1` if we know that a was nonzero. We have to do the optimization in 2 places due to if we have an optab entry for popcount or not. Built and tested for aarch64-linux-gnu. PR middle-end/90693 gcc/ChangeLog: * internal-fn.cc (expand_POPCOUNT): Handle the second argument being `-1` for `<= 1`. * tree-ssa-math-opts.cc (match_single_bit_test): Handle LE/GT cases. (math_opts_dom_walker::after_dom_children): Call match_single_bit_test for LE_EXPR/GT_EXPR also. gcc/testsuite/ChangeLog: * gcc.target/aarch64/popcnt-le-1.c: New test. * gcc.target/aarch64/popcnt-le-2.c: New test. * gcc.target/aarch64/popcnt-le-3.c: New test. Signed-off-by:
Andrew Pinski <quic_apinski@quicinc.com>
-
John David Anglin authored
pa_print_operand handles both operand orders for scaled index addresses, so it isn't necessary to canonicalize the order of operands. 2024-09-09 John David Anglin <danglin@gcc.gnu.org> gcc/ChangeLog: * config/pa/pa.cc (pa_legitimate_address_p): Don't canonicalize operand order of scaled index addresses.
-
Richard Biener authored
When evaluating the difference of two aligned pointers in CCP we fail to handle the EXACT_DIV_EXPR by the element size that occurs. The testcase then also exercises modulo to test alignment but modulo by a power-of-two isn't handled either. PR tree-optimization/116514 * tree-ssa-ccp.cc (bit_value_binop): Handle EXACT_DIV_EXPR like TRUNC_DIV_EXPR. Handle exact division of a signed value by a power-of-two like a shift. Handle unsigned division by a power-of-two like a shift. Handle unsigned TRUNC_MOD_EXPR by power-of-two, handle signed TRUNC_MOD_EXPR by power-of-two if the result is zero. * gcc.dg/tree-ssa/ssa-ccp-44.c: New testcase.
-
Richard Biener authored
The following avoids classifying a double reduction that's not actually a reduction in the outer loop (because its value isn't used outside of the outer loop). This avoids us ICEing on the unexpected stmt/SLP node arrangement. PR tree-optimization/116647 * tree-vect-loop.cc (vect_is_simple_reduction): Add missing check to double reduction detection. * gcc.dg/torture/pr116647.c: New testcase. * gcc.dg/vect/no-scevccp-pr86725-2.c: Adjust expected pattern. * gcc.dg/vect/no-scevccp-pr86725-4.c: Likewise.
-
Eric Botcazou authored
gcc/testsuite PR ada/115250 * gnat.dg/opt58_pkg.ads: Convert to Unix line ending. * gnat.dg/opt58.adb: Likewise and pass -gnatws to the compiler.
-
Eric Botcazou authored
gcc/testsuite PR ada/115246 * gnat.dg/alignment14.adb (My_Int2): Delete. (Arr2): Likewise.
-
Andrew Pinski authored
I noticed this folding inside fab could be done else where and could even improve inlining decisions and a few other things so let's move it to fold_stmt. It also fixes PR 116601 because places which call fold_stmt already have to deal with the stmt becoming a non-throw statement. For the fix for PR 116601 on the branches should be the original patch rather than a backport of this one. Bootstrapped and tested on x86_64-linux-gnu. PR tree-optimization/116601 gcc/ChangeLog: * gimple-fold.cc (optimize_memcpy_to_memset): Move from tree-ssa-ccp.cc and rename. Also return true if the optimization happened. (gimple_fold_builtin_memory_op): Call optimize_memcpy_to_memset. (fold_stmt_1): Call optimize_memcpy_to_memset for load/store copies. * tree-ssa-ccp.cc (optimize_memcpy): Delete. (pass_fold_builtins::execute): Remove code that calls optimize_memcpy. gcc/testsuite/ChangeLog: * gcc.dg/pr78408-1.c: Adjust dump scan to match where the optimization now happens. * g++.dg/torture/except-2.C: New test. Signed-off-by:
Andrew Pinski <quic_apinski@quicinc.com>
-
Richard Biener authored
There was a reported regression on x86-64 with -march=cascadelake and -m32 where epilogue vectorization causes a different number of SLPed loops. Fixed by disabling epilogue vectorization for the testcase. * gcc.dg/vect/fast-math-vect-call-2.c: Disable epilogue vectorization.
-
Jakub Jelinek authored
The test as committed without the tree-vrp.cc change only FAILs with FAIL: gcc.dg/pr116588.c scan-tree-dump-not vrp2 "0 != 0" The DEBUG code in there was just to make it easier to debug, but doesn't actually fail when the test is miscompiled. We don't need such debugging code in simple tests like that, but it is useful if they abort when miscompiled. With this patch without the tree-vrp.cc change I see FAIL: gcc.dg/pr116588.c execution test FAIL: gcc.dg/pr116588.c scan-tree-dump-not vrp2 "0 != 0" and with it it passes. 2024-09-09 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/116588 * gcc.dg/pr116588.c: Remove -DDEBUG from dg-options. (main): Remove debugging code and simplify.
-
Thomas Schwinge authored
Match: Fix ordered and nonequal: Fix 'gcc.dg/opt-ordered-and-nonequal-1.c' re 'LOGICAL_OP_NON_SHORT_CIRCUIT' [PR116635] Fix up to make 'gcc.dg/opt-ordered-and-nonequal-1.c' of commit 91421e21 "Match: Fix ordered and nonequal" work for default 'LOGICAL_OP_NON_SHORT_CIRCUIT == false' configurations. PR testsuite/116635 gcc/testsuite/ * gcc.dg/opt-ordered-and-nonequal-1.c: Fix re 'LOGICAL_OP_NON_SHORT_CIRCUIT'.
-
Andrew Pinski authored
This small cleanup removes a redundant check for gimple_assign_cast_p and reformats based on that. Also changes the if statement that checks if the integral type and the check to see if the constant fits into the new type such that it returns null and reformats based on that. Also moves the check for has_single_use earlier so it is less complex still a cheaper check than some of the others (like the check on the integer side). This was noticed when adding a few new things to factor_out_conditional_operation but those are not ready to submit yet. Note there are no functional difference with this change. Bootstrapped and tested on x86_64-linux-gnu. gcc/ChangeLog: * tree-ssa-phiopt.cc (factor_out_conditional_operation): Move the has_single_use checks much earlier. Remove redundant check for gimple_assign_cast_p. Change around the check if the integral consts fits into the new type. Signed-off-by:
Andrew Pinski <quic_apinski@quicinc.com>
-
Haochen Jiang authored
This patch will add those recent aliased CPU names into documentation for clearness. gcc/ChangeLog: PR target/116617 * doc/invoke.texi: Add meteorlake, raptorlake and lunarlake.
-
GCC Administrator authored
-
- Sep 08, 2024
-
-
H.J. Lu authored
Don't use temp for a PARALLEL BLKmode argument of an EXPR_LIST expression in a TImode register. Otherwise, the TImode variable will be put in the GPR save area which guarantees only 8-byte alignment. gcc/ PR target/116621 * config/i386/i386.cc (ix86_gimplify_va_arg): Don't use temp for a PARALLEL BLKmode container of an EXPR_LIST expression in a TImode register. gcc/testsuite/ PR target/116621 * gcc.target/i386/pr116621.c: New test. Signed-off-by:
H.J. Lu <hjl.tools@gmail.com>
-
Jørgen Kvalsvik authored
Cache the source files as they are read, rather than discarding them at the end of output_lines (), and move the reading of the source file to the new function slurp. This patch does not really change anything other than moving the file reading out of output_file, but set gcov up for more interaction with the source file. The motvating example is reporting coverage on functions from different source files, notably C++ headers and ((always_inline)). Here is an example of what gcov does today: hello.h: inline __attribute__((always_inline)) int hello (const char *s) { if (s) printf ("hello, %s!\n", s); else printf ("hello, world!\n"); return 0; } hello.c: int notmain(const char *entity) { return hello (entity); } int main() { const char *empty = 0; if (!empty) hello (empty); else puts ("Goodbye!"); } $ gcov -abc hello function notmain called 0 returned 0% blocks executed 0% #####: 4:int notmain(const char *entity) %%%%%: 4-block 2 branch 0 never executed (fallthrough) branch 1 never executed -: 5:{ #####: 6: return hello (entity); %%%%%: 6-block 7 -: 7:} Clearly there is a branch in notmain, but the branch comes from the inlining of hello. This is not very obvious from looking at the output. Here is hello.h.gcov: -: 3:inline __attribute__((always_inline)) -: 4:int hello (const char *s) -: 5:{ #####: 6: if (s) %%%%%: 6-block 3 branch 0 never executed (fallthrough) branch 1 never executed %%%%%: 6-block 2 branch 2 never executed (fallthrough) branch 3 never executed #####: 7: printf ("hello, %s!\n", s); %%%%%: 7-block 4 call 0 never executed %%%%%: 7-block 3 call 1 never executed -: 8: else #####: 9: printf ("hello, world!\n"); %%%%%: 9-block 5 call 0 never executed %%%%%: 9-block 4 call 1 never executed #####: 10: return 0; %%%%%: 10-block 6 %%%%%: 10-block 5 -: 11:} The blocks from the different call sites have all been interleaved. The reporting could tuned be to list the inlined function, too, like this: 1: 4:int notmain(const char *entity) -: == inlined from hello.h == 1: 6: if (s) branch 0 taken 0 (fallthrough) branch 1 taken 1 #####: 7: printf ("hello, %s!\n", s); %%%%%: 7-block 3 call 0 never executed -: 8: else 1: 9: printf ("hello, world!\n"); 1: 9-block 4 call 0 returned 1 1: 10: return 0; 1: 10-block 5 -: == inlined from hello.h (end) == -: 5:{ 1: 6: return hello (entity); 1: 6-block 7 -: 7:} Implementing something to this effect relies on having the sources for both files (hello.c, hello.h) available, which is what this patch sets up. Note that the previous reading code would leak the source file content, and explicitly storing them is not a huge departure nor performance implication. I verified this with valgrind: With slurp: $ valgrind gcov ./hello == == Memcheck, a memory error detector == == Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al. == == Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info == == Command: ./gcc/gcov demo == == File 'hello.c' Lines executed:100.00% of 4 Creating 'hello.c.gcov' File 'hello.h' Lines executed:75.00% of 4 Creating 'hello.h.gcov' == == == == HEAP SUMMARY: == == in use at exit: 84,907 bytes in 54 blocks == == total heap usage: 254 allocs, 200 frees, 137,156 bytes allocated == == == == LEAK SUMMARY: == == definitely lost: 1,237 bytes in 22 blocks == == indirectly lost: 562 bytes in 18 blocks == == possibly lost: 0 bytes in 0 blocks == == still reachable: 83,108 bytes in 14 blocks == == of which reachable via heuristic: == == newarray : 1,544 bytes in 1 blocks == == suppressed: 0 bytes in 0 blocks == == Rerun with --leak-check=full to see details of leaked memory == == == == For lists of detected and suppressed errors, rerun with: -s == == ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) Without slurp: $ valgrind gcov ./demo == == Memcheck, a memory error detector == == Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al. == == Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info == == Command: ./gcc/gcov demo == == File 'hello.c' Lines executed:100.00% of 4 Creating 'hello.c.gcov' File 'hello.h' Lines executed:75.00% of 4 Creating 'hello.h.gcov' Lines executed:87.50% of 8 == == == == HEAP SUMMARY: == == in use at exit: 85,316 bytes in 82 blocks == == total heap usage: 250 allocs, 168 frees, 137,084 bytes allocated == == == == LEAK SUMMARY: == == definitely lost: 1,646 bytes in 50 blocks == == indirectly lost: 562 bytes in 18 blocks == == possibly lost: 0 bytes in 0 blocks == == still reachable: 83,108 bytes in 14 blocks == == of which reachable via heuristic: == == newarray : 1,544 bytes in 1 blocks == == suppressed: 0 bytes in 0 blocks == == Rerun with --leak-check=full to see details of leaked memory == == == == For lists of detected and suppressed errors, rerun with: -s == == ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) gcc/ChangeLog: * gcov.cc (release_structures): Release source_lines. (slurp): New function. (output_lines): Read sources with slurp.
-
Jørgen Kvalsvik authored
Since this is a pure compile test it makes sense to inform dejagnu of it. gcc/testsuite/ChangeLog: * gcc.misc-tests/gcov-23.c: Use dg-compile, not gcc -c
-
GCC Administrator authored
-
- Sep 07, 2024
-
-
Andrew Pinski authored
This is a simple fix which adds the target supports requirement of int128 to the testcase too. Pushed as obvious after testing to make sure the testcase is UNSUPPORTED now with -m32 but working with -m64 on x86_64-linux-gnu. gcc/testsuite/ChangeLog: * gcc.dg/pr116588.c: Require int128. Signed-off-by:
Andrew Pinski <quic_apinski@quicinc.com>
-
Jason Merrill authored
We were silently accepting the pr65923.C specialization of std::swap with the wrong exception specification; it should be declared noexcept. Let's limit ignoring mismatch with system headers to extern "C" functions so we get a diagnostic for the C++ library. In the case of an omitted exception-specification, let's also lower the error to a pedwarn, and copy the missing spec over, to avoid a hard break for code that accidentally relied on the old behavior. ...except extern "C" functions keep the new spec, to avoid breaking dubious code like noexcept-type19.C. gcc/cp/ChangeLog: * decl.cc (check_redeclaration_exception_specification): Remove OPT_Wsystem_headers from pedwarn when the old declaration is in a system header. Also check std namespace. gcc/testsuite/ChangeLog: * g++.dg/diagnostic/pr65923.C: Add noexcept. * g++.dg/cpp1z/aligned-new3.C: Expect pedwarn. * g++.dg/cpp1z/noexcept-type19.C: Add comment.
-
Andrew Pinski authored
It was pointed out in https://gcc.gnu.org/pipermail/gcc-patches/2024-September/662183.html , that the wording with this print has too many words. Fixed thusly. Pushed as obvious after a build and test for x86_64-linux-gnu. gcc/ChangeLog: * gimple-ssa-split-paths.cc (is_feasible_trace): Fix wording on the print. Signed-off-by:
Andrew Pinski <quic_apinski@quicinc.com>
-
Patrick Palka authored
Here we correctly defer partial substitution into the lambda used as a default template argument, but then incorrectly perform the full substitution, because add_extra_args adds outer template arguments from the full substitution that are not related to the original template context of the lambda. For example, the template depth of the first lambda is 1 but add_extra_args return a set of args with 3 levels, with the inner level corresponding to the parameters of v1 (good) and the outer levels corresponding to those of A and B (bad). For the cases that we're interested in, add_extra_args can assume that the deferred args are a full set of template arguments, and so it suffices to just substitute into the deferred args and not do any additional merging. This patch refines add_extra_args accordingly, and additionally makes it look for the tf_partial flag instead of for dependent args to decide if the deferred substitution is a partial one. This reveals we were neglecting to set tf_partial when substituting into a default template argument in a template context. PR c++/116567 gcc/cp/ChangeLog: * pt.cc (coerce_template_parms): Set tf_partial when substituting into a default template argument in a template context. (build_extra_args): Set TREE_STATIC on the deferred args if this is a partial substitution. (add_extra_args): Check TREE_STATIC instead of dependence of args. Adjust merging behavior in that case. (tsubst_lammda_expr): Check for tf_partial instead of dependence of args when determining whether to defer substitution. (tsubst_expr) <case LAMBDA_EXPR>: Remove tf_partial early exit. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/lambda-targ7.C: New test. Reviewed-by:
Jason Merrill <jason@redhat.com>
-
Andrew MacLeod authored
PR tree-optimization/116588 gcc/ * tree-vrp.cc (execute_fast_vrp): Start with all edges executable. gcc/testsuite/ * gcc.dg/pr116588.c: New.
-
Zhao Dingyi authored
This patch aims to add the missing instruction types to the XiangShan-Nanhu scheduler model. The current XiangShan -Nanhu model lacks the trap, atomic trap, fcvt_i2f, and fcvt_f2i instructions. The trap, atomic, and i2f instructions belong to xs_jmp_rs. [1] The f2i instruction belongs to xs_fmisc_rs.[2] [1] https://github.com/OpenXiangShan/XiangShan/blob/v2.0/src/main/scala/xiangshan/package.scala#L780 [2] https://github.com/OpenXiangShan/XiangShan/blob/v2.0/src/main/scala/xiangshan/backend/decode/DecodeUnit.scala#L290 gcc/ChangeLog: * config/riscv/xiangshan.md: Add atomic, trap, fcvt_i2f, fcvt_f2i.
-
Jin Ma authored
Since the THeadVector vsetvli does not support vl as an immediate, we need to convert 0 to zero when outputting asm. PR target/116592 gcc/ChangeLog: * config/riscv/thead.cc (th_asm_output_opcode): Change '0' to "zero" gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/xtheadvector/pr116592.c: New test.
-
Thomas Koenig authored
gcc/fortran/ChangeLog: * arith.cc (gfc_reduce_unsigned): New function. (gfc_arith_error): Add ARITH_UNSIGNED_TRUNCATED and ARITH_UNSIGNED_NEGATIVE. (gfc_arith_init_1): Initialize unsigned types. (gfc_check_unsigned_range): New function. (gfc_range_check): Handle unsigned types. (gfc_arith_uminus): Likewise. (gfc_arith_plus): Likewise. (gfc_arith_minus): Likewise. (gfc_arith_times): Likewise. (gfc_arith_divide): Likewise. (gfc_compare_expr): Likewise. (eval_intrinsic): Likewise. (gfc_int2int): Also convert unsigned. (gfc_uint2uint): New function. (gfc_int2uint): New function. (gfc_uint2int): New function. (gfc_uint2real): New function. (gfc_uint2complex): New function. (gfc_real2uint): New function. (gfc_complex2uint): New function. (gfc_log2uint): New function. (gfc_uint2log): New function. * arith.h (gfc_int2uint, gfc_uint2uint, gfc_uint2int, gfc_uint2real): Add prototypes. (gfc_uint2complex, gfc_real2uint, gfc_complex2uint, gfc_log2uint): Likewise. (gfc_uint2log): Likewise. * check.cc (gfc_boz2uint): New function (type_check2): New function. (int_or_real_or_unsigned_check): New function. (less_than_bitsizekind): Adjust for unsingeds. (less_than_bitsize2): Likewise. (gfc_check_allocated): Likewise. (gfc_check_mod): Likewise. (gfc_check_bge_bgt_ble_blt): Likewise. (gfc_check_bitfcn): Likewise. (gfc_check_digits): Likewise. (gfc_check_dshift): Likewise. (gfc_check_huge): Likewise. (gfc_check_iu): New function. (gfc_check_iand_ieor_ior): Adjust for unsigneds. (gfc_check_ibits): Likewise. (gfc_check_uint): New function. (gfc_check_ishft): Adjust for unsigneds. (gfc_check_ishftc): Likewise. (gfc_check_min_max): Likewise. (gfc_check_merge_bits): Likewise. (gfc_check_selected_int_kind): Likewise. (gfc_check_shift): Likewise. (gfc_check_mvbits): Likewise. (gfc_invalid_unsigned_ops): Likewise. * decl.cc (gfc_match_decl_type_spec): Likewise. * dump-parse-tree.cc (show_expr): Likewise. * expr.cc (gfc_get_constant_expr): Likewise. (gfc_copy_expr): Likewise. (gfc_extract_int): Likewise. (numeric_type): Likewise. * gfortran.h (enum arith): Extend with ARITH_UNSIGNED_TRUNCATED and ARITH_UNSIGNED_NEGATIVE. (enum gfc_isym_id): Extend with GFC_ISYM_SU_KIND and GFC_ISYM_UINT. (gfc_check_unsigned_range): New prototype- (gfc_arith_error): Likewise. (gfc_reduce_unsigned): Likewise. (gfc_boz2uint): Likewise. (gfc_invalid_unsigned_ops): Likewise. (gfc_convert_mpz_to_unsigned): Likewise. * gfortran.texi: Add some rudimentary documentation. * intrinsic.cc (gfc_type_letter): Adjust for unsigneds. (add_functions): Add uint and adjust functions to be called. (add_conversions): Add unsigned conversions. (gfc_convert_type_warn): Adjust for unsigned. * intrinsic.h (gfc_check_iu, gfc_check_uint, gfc_check_mod, gfc_simplify_uint, gfc_simplify_selected_unsigned_kind, gfc_resolve_uint): New prototypes. * invoke.texi: Add -funsigned. * iresolve.cc (gfc_resolve_dshift): Handle unsigneds. (gfc_resolve_iand): Handle unsigneds. (gfc_resolve_ibclr): Handle unsigneds. (gfc_resolve_ibits): Handle unsigneds. (gfc_resolve_ibset): Handle unsigneds. (gfc_resolve_ieor): Handle unsigneds. (gfc_resolve_ior): Handle unsigneds. (gfc_resolve_uint): Handle unsigneds. (gfc_resolve_merge_bits): Handle unsigneds. (gfc_resolve_not): Handle unsigneds. * lang.opt: Add -funsigned. * libgfortran.h: Add BT_UNSIGNED. * match.cc (gfc_match_type_spec): Match UNSIGNED. * misc.cc (gfc_basic_typename): Add UNSIGNED. (gfc_typename): Likewise. * primary.cc (convert_unsigned): New function. (match_unsigned_constant): New function. (gfc_match_literal_constant): Handle unsigned. * resolve.cc (resolve_operator): Handle unsigned. (resolve_ordinary_assign): Likewise. * simplify.cc (convert_mpz_to_unsigned): Renamed to... (gfc_convert_mpz_to_unsigned): and adjusted. (gfc_simplify_bit_size): Adjusted for unsigned. (compare_bitwise): Likewise. (gfc_simplify_bge): Likewise. (gfc_simplify_bgt): Likewise. (gfc_simplify_ble): Likewise. (gfc_simplify_blt): Likewise. (simplify_cmplx): Likewise. (gfc_simplify_digits): Likewise. (simplify_dshift): Likewise. (gfc_simplify_huge): Likewise. (gfc_simplify_iand): Likewise. (gfc_simplify_ibclr): Likewise. (gfc_simplify_ibits): Likewise. (gfc_simplify_ibset): Likewise. (gfc_simplify_ieor): Likewise. (gfc_simplify_uint): Likewise. (gfc_simplify_ior): Likewise. (simplify_shift): Likewise. (gfc_simplify_ishftc): Likewise. (gfc_simplify_merge_bits): Likewise. (min_max_choose): Likewise. (gfc_simplify_mod): Likewise. (gfc_simplify_modulo): Likewise. (gfc_simplify_popcnt): Likewise. (gfc_simplify_range): Likewise. (gfc_simplify_selected_unsigned_kind): Likewise. (gfc_convert_constant): Likewise. * target-memory.cc (size_unsigned): New function. (gfc_element_size): Adjust for unsigned. * trans-const.h (gfc_conv_mpz_unsigned_to_tree): Add prototype. * trans-const.cc (gfc_conv_mpz_unsigned_to_tree): Handle unsigneds. (gfc_conv_constant_to_tree): Likewise. * trans-decl.cc (gfc_conv_cfi_to_gfc): Put in "not yet implemented". * trans-expr.cc (gfc_conv_gfc_desc_to_cfi_desc): Likewise. * trans-stmt.cc (gfc_trans_integer_select): Handle unsigned. (gfc_trans_select): Likewise. * trans-intrinsic.cc (gfc_conv_intrinsic_mod): Handle unsigned. (gfc_conv_intrinsic_shift): Likewise. (gfc_conv_intrinsic_function): Add GFC_ISYM_UINT. * trans-io.cc (enum iocall): Add IOCALL_X_UNSIGNED and IOCALL_X_UNSIGNED_WRITE. (gfc_build_io_library_fndecls): Add transfer_unsigned and transfer_unsigned_write. (transfer_expr): Handle unsigneds. * trans-types.cc (gfc_unsinged_kinds): New array. (gfc_unsigned_types): Likewise. (gfc_init_kinds): Handle them. (validate_unsigned): New function. (gfc_validate_kind): Use it. (gfc_build_unsigned_type): New function. (gfc_init_types): Use it. (gfc_get_unsigned_type): New function. (gfc_typenode_for_spec): Handle unsigned. * trans-types.h (gfc_get_unsigned_type): New prototype. libgfortran/ChangeLog: * gfortran.map: Add _gfortran_transfer_unsgned and _gfortran_transfer-signed. * io/io.h (set_unsigned): New prototype. (us_max): New prototype. (read_decimal_unsigned): New prototype. (write_iu): New prototype. * io/list_read.c (convert_unsigned): New function. (read_integer): Also handle unsigneds. (list_formatted_read_scalar): Handle unsigneds. (nml_read_obj): Likewise. * io/read.c (set_unsigned): New function. (us_max): New function. (read_utf8): Whitespace fixes. (read_default_char1): Whitespace fixes. (read_a_char4): Whitespace fixes. (next_char): Whiltespace fixes. (read_decimal_unsigned): New function. (read_f): Whitespace fixes. (read_x): Whitespace fixes. * io/transfer.c (transfer_unsigned): New function. (transfer_unsigned_write): New function. (require_one_of_two_types): New function. (formatted_transfer_scalar_read): Use it. (formatted_transfer_scalar_write): Also use it. * io/write.c (write_decimal_unsigned): New function. (write_iu): New function. (write_unsigned): New function. (list_formatted_write_scalar): Adjust for unsigneds. * libgfortran.h (GFC_UINTEGER_1_HUGE): Define. (GFC_UINTEGER_2_HUGE): Define. (GFC_UINTEGER_4_HUGE): Define. (GFC_UINTEGER_8_HUGE): Define. (GFC_UINTEGER_16_HUGE): Define. (HAVE_GFC_UINTEGER_1): Undefine (done by mk-kind-h.sh) (HAVE_GFC_UINTEGER_4): Likewise. * mk-kinds-h.sh: Add GFC_UINTEGER_*_HUGE. gcc/testsuite/ChangeLog: * gfortran.dg/unsigned_1.f90: New test. * gfortran.dg/unsigned_10.f90: New test. * gfortran.dg/unsigned_11.f90: New test. * gfortran.dg/unsigned_12.f90: New test. * gfortran.dg/unsigned_13.f90: New test. * gfortran.dg/unsigned_14.f90: New test. * gfortran.dg/unsigned_15.f90: New test. * gfortran.dg/unsigned_16.f90: New test. * gfortran.dg/unsigned_17.f90: New test. * gfortran.dg/unsigned_18.f90: New test. * gfortran.dg/unsigned_19.f90: New test. * gfortran.dg/unsigned_2.f90: New test. * gfortran.dg/unsigned_20.f90: New test. * gfortran.dg/unsigned_21.f90: New test. * gfortran.dg/unsigned_22.f90: New test. * gfortran.dg/unsigned_23.f90: New test. * gfortran.dg/unsigned_24.f: New test. * gfortran.dg/unsigned_3.f90: New test. * gfortran.dg/unsigned_4.f90: New test. * gfortran.dg/unsigned_5.f90: New test. * gfortran.dg/unsigned_6.f90: New test. * gfortran.dg/unsigned_7.f90: New test. * gfortran.dg/unsigned_8.f90: New test. * gfortran.dg/unsigned_9.f90: New test.
-
Jakub Jelinek authored
cat abc.C #define A(n) struct T##n {} t##n; #define B(n) A(n##0) A(n##1) A(n##2) A(n##3) A(n##4) A(n##5) A(n##6) A(n##7) A(n##8) A(n##9) #define C(n) B(n##0) B(n##1) B(n##2) B(n##3) B(n##4) B(n##5) B(n##6) B(n##7) B(n##8) B(n##9) #define D(n) C(n##0) C(n##1) C(n##2) C(n##3) C(n##4) C(n##5) C(n##6) C(n##7) C(n##8) C(n##9) #define E(n) D(n##0) D(n##1) D(n##2) D(n##3) D(n##4) D(n##5) D(n##6) D(n##7) D(n##8) D(n##9) E(1) E(2) E(3) int main () { return 0; } ./xg++ -B ./ -o abc{.o,.C} -flto -flto-partition=1to1 -O2 -g -fdebug-types-section -c ./xgcc -B ./ -o abc{,.o} -flto -flto-partition=1to1 -O2 (not included in testsuite as it takes a while to compile) FAILs with lto-wrapper: fatal error: Too many copied sections: Operation not supported compilation terminated. /usr/bin/ld: error: lto-wrapper failed collect2: error: ld returned 1 exit status The following patch fixes that. Most of the 64K+ section support for reading and writing was already there years ago (and especially reading used quite often already) and a further bug fixed in it in the PR104617 fix. Yet, the fix isn't solely about removing the if (new_i - 1 >= SHN_LORESERVE) { *err = ENOTSUP; return "Too many copied sections"; } 5 lines, the missing part was that the function only handled reading of the .symtab_shndx section but not copying/updating of it. If the result has less than 64K-epsilon sections, that actually wasn't needed, but e.g. with -fdebug-types-section one can exceed that pretty easily (reported to us on WebKitGtk build on ppc64le). Updating the section is slightly more complicated, because it basically needs to be done in lock step with updating the .symtab section, if one doesn't need to use SHN_XINDEX in there, the section should (or should be updated to) contain SHN_UNDEF entry, otherwise needs to have whatever would be overwise stored but couldn't fit. But repeating due to that all the symtab decisions what to discard and how to rewrite it would be ugly. So, the patch instead emits the .symtab_shndx section (or sections) last and prepares the content during the .symtab processing and in a second pass when going just through .symtab_shndx sections just uses the saved content. 2024-09-07 Jakub Jelinek <jakub@redhat.com> PR lto/116614 * simple-object-elf.c (SHN_COMMON): Align comment with neighbouring comments. (SHN_HIRESERVE): Use uppercase hex digits instead of lowercase for consistency. (simple_object_elf_find_sections): Formatting fixes. (simple_object_elf_fetch_attributes): Likewise. (simple_object_elf_attributes_merge): Likewise. (simple_object_elf_start_write): Likewise. (simple_object_elf_write_ehdr): Likewise. (simple_object_elf_write_shdr): Likewise. (simple_object_elf_write_to_file): Likewise. (simple_object_elf_copy_lto_debug_section): Likewise. Don't fail for new_i - 1 >= SHN_LORESERVE, instead arrange in that case to copy over .symtab_shndx sections, though emit those last and compute their section content when processing associated .symtab sections. Handle simple_object_internal_read failure even in the .symtab_shndx reading case.
-