- Sep 10, 2024
-
-
Jonathan Wakely authored
The changes to implement LWG 2579 (r10-327-gdb33efde17932f) made std::string::assign use the propagate_on_container_copy_assignment (POCCA) trait, for consistency with operator=(const basic_string&). However, this also unintentionally affected operator=(basic_string&&) which calls assign(str) to make a deep copy when performing a move is not possible. The fix is for the move assignment operator to call _M_assign(str) instead of assign(str), as this just does the deep copy and doesn't check the POCCA trait first. The bug only affects the unlikely/useless combination of POCCA==true and POCMA==false, but we should fix it for correctness anyway. it should also make move assignment slightly cheaper to compile and execute, because we skip the extra code in assign(const basic_string&). libstdc++-v3/ChangeLog: PR libstdc++/116641 * include/bits/basic_string.h (operator=(basic_string&&)): Call _M_assign instead of assign. * testsuite/21_strings/basic_string/allocator/116641.cc: New test.
-
Jakub Jelinek authored
The following testcase is miscompiled, because get_member_function_from_ptrfunc emits something like (((FUNCTION.__pfn & 1) != 0) ? ptr + FUNCTION.__delta + FUNCTION.__pfn - 1 : FUNCTION.__pfn) (ptr + FUNCTION.__delta, ...) or so, so FUNCTION tree is used there 5 times. There is if (TREE_SIDE_EFFECTS (function)) function = save_expr (function); but in this case function doesn't have side-effects, just nested ARRAY_REFs. Now, if all the FUNCTION trees would be shared, it would work fine, FUNCTION is evaluated in the first operand of COND_EXPR; but unfortunately that isn't the case, both the BIT_AND_EXPR shortening and conversion to bool done for build_conditional_expr actually unshare_expr that first expression, but none of the other 4 are unshared. With -fsanitize=bounds, .UBSAN_BOUNDS calls are added to the ARRAY_REFs and use save_expr to avoid evaluating the argument multiple times, but because that FUNCTION tree is first used in the second argument of COND_EXPR (i.e. conditionally), the SAVE_EXPR initialization is done just there and then the third argument of COND_EXPR just uses the uninitialized temporary and so does the first argument computation as well. The following patch fixes that by doing save_expr even if !TREE_SIDE_EFFECTS, but to avoid doing that too often only if !nonvirtual and if the expression isn't a simple decl. 2024-09-10 Jakub Jelinek <jakub@redhat.com> PR c++/116449 * typeck.cc (get_member_function_from_ptrfunc): Use save_expr on instance_ptr and function even if it doesn't have side-effects, as long as it isn't a decl. * g++.dg/ubsan/pr116449.C: New test.
-
Jonathan Wakely authored
Since r15-3532-g7cebc6384a0ad6 18_support/new_nothrow.cc fails in C++98 mode because G++ diagnoses missing exception specifications for the user-defined (de)allocation functions. Add throw(std::bad_alloc) and throw() for C++98 mode. Similarly, 26_numerics/headers/numeric/synopsis.cc fails in C++20 mode because the declarations of gcd and lcm are not noexcept. libstdc++-v3/ChangeLog: * testsuite/18_support/new_nothrow.cc (THROW_BAD_ALLOC): Define macro to add exception specifications for C++98 mode. (NOEXCEPT): Expand to throw() for C++98 mode. * testsuite/26_numerics/headers/numeric/synopsis.cc (gcd, lcm): Add noexcept.
-
Marek Polacek authored
Here we wrongly mark the reference temporary for g TREE_READONLY, so it's put in .rodata and so we can't modify its subobject even when the subobject is marked mutable. This is so since r9-869. r14-1785 fixed a similar problem, but not in set_up_extended_ref_temp. PR c++/116369 gcc/cp/ChangeLog: * call.cc (set_up_extended_ref_temp): Don't mark a temporary TREE_READONLY if its type is TYPE_HAS_MUTABLE_P. gcc/testsuite/ChangeLog: * g++.dg/tree-ssa/initlist-opt7.C: New test.
-
Prathamesh Kulkarni authored
The patch adds an option -foffload-abi-host-opts, which is set by host in TARGET_OFFLOAD_OPTIONS, and mkoffload then passes its value to host_compiler. gcc/ChangeLog: PR target/96265 * common.opt (foffload-abi-host-opts): New option. * config/aarch64/aarch64.cc (aarch64_offload_options): Pass -foffload-abi-host-opts. * config/i386/i386-options.cc (ix86_offload_options): Likewise. * config/rs6000/rs6000.cc (rs6000_offload_options): Likewise. * config/nvptx/mkoffload.cc (offload_abi_host_opts): Define. (compile_native): Append offload_abi_host_opts to argv_obstack. (main): Handle option -foffload-abi-host-opts. * config/gcn/mkoffload.cc (offload_abi_host_opts): Define. (compile_native): Append offload_abi_host_opts to argv_obstack. (main): Handle option -foffload-abi-host-opts. * lto-wrapper.cc (merge_and_complain): Handle -foffload-abi-host-opts. (append_compiler_options): Likewise. * opts.cc (common_handle_option): Likewise. Signed-off-by:
Prathamesh Kulkarni <prathameshk@nvidia.com>
-
Richard Biener authored
Permute nodes do not have a representative so we have to guard vect_is_slp_load_node against those. PR tree-optimization/116658 * tree-vect-slp.cc (vect_is_slp_load_node): Make sure node isn't a permute. * g++.dg/vect/pr116658.cc: New testcase.
-
Pan Li authored
This patch would like to support the form 2 of the scalar signed integer .SAT_ADD. Aka below example: 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(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_2 (int8_t x, int8_t y) 6 │ { 7 │ int8_t sum; 8 │ unsigned char x.0_1; 9 │ unsigned char y.1_2; 10 │ unsigned char _3; 11 │ signed char _4; 12 │ signed char _5; 13 │ int8_t _6; 14 │ _Bool _11; 15 │ signed char _12; 16 │ signed char _13; 17 │ signed char _14; 18 │ signed char _22; 19 │ signed char _23; 20 │ 21 │ ;; basic block 2, loop depth 0 22 │ ;; pred: ENTRY 23 │ x.0_1 = (unsigned char) x_7(D); 24 │ y.1_2 = (unsigned char) y_8(D); 25 │ _3 = x.0_1 + y.1_2; 26 │ sum_9 = (int8_t) _3; 27 │ _4 = x_7(D) ^ y_8(D); 28 │ _5 = x_7(D) ^ sum_9; 29 │ _23 = ~_4; 30 │ _22 = _5 & _23; 31 │ if (_22 >= 0) 32 │ goto <bb 4>; [42.57%] 33 │ else 34 │ goto <bb 3>; [57.43%] 35 │ ;; succ: 4 36 │ ;; 3 37 │ 38 │ ;; basic block 3, loop depth 0 39 │ ;; pred: 2 40 │ _11 = x_7(D) < 0; 41 │ _12 = (signed char) _11; 42 │ _13 = -_12; 43 │ _14 = _13 ^ 127; 44 │ ;; succ: 4 45 │ 46 │ ;; basic block 4, loop depth 0 47 │ ;; pred: 2 48 │ ;; 3 49 │ # _6 = PHI <sum_9(2), _14(3)> 50 │ return _6; 51 │ ;; succ: EXIT 52 │ 53 │ } After this patch: 4 │ __attribute__((noinline)) 5 │ int8_t sat_s_add_int8_t_fmt_2 (int8_t x, int8_t y) 6 │ { 7 │ int8_t _6; 8 │ 9 │ ;; basic block 2, loop depth 0 10 │ ;; pred: ENTRY 11 │ _6 = .SAT_ADD (x_7(D), y_8(D)); [tail call] 12 │ return _6; 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 2 of signed .SAT_ADD matching. Signed-off-by:
Pan Li <pan2.li@intel.com>
-
Eric Botcazou authored
memmodel.h must be included alongside tm_p.h for the sake of the SPARC port. gcc/ada/ * gcc-interface/misc.cc: Include memmodel.h before tm_p.h.
-
Viljar Indus authored
gcc/ada/ * gcc-interface/decl.cc: Use same warning characters in continuation messages. * gcc-interface/trans.cc: Likewise.
-
Javier Miranda authored
Enable reporting an error when this new aspect/pragma is set to True, and the sources are compiled without language extensions allowed. gcc/ada/ * sem_ch13.adb (Analyze_One_Aspect): Call Error_Msg_GNAT_Extension() to report an error when the aspect First_Controlling_Parameter is set to True and the sources are compiled without Core_Extensions_ Allowed. * sem_prag.adb (Pragma_First_Controlling_Parameter): Call subprogram Error_Msg_GNAT_Extension() to report an error when the aspect First_Controlling_Parameter is set to True and the sources are compiled without Core_Extensions_Allowed. Report an error when the aspect pragma does not confirm an inherited True value.
-
Viljar Indus authored
The total number of characters on a source code line is different on Windows and Linux based systems (CRLF vs LF endings). Use the last non line change character to adjust printing the spans that go over the end of line. gcc/ada/ * diagnostics-pretty_emitter.adb (Get_Last_Line_Char): New. Get the last non line change character. Write_Span_Labels use the adjusted line end pointer to calculate the length of the span.
-
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.
-