aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2023-11-05i386: Add LEGACY_INDEX_REG register class.Uros Bizjak2-16/+22
Also rename LEGACY_REGS to LEGACY_GENERAL_REGS. gcc/ChangeLog: * config/i386/i386.h (enum reg_class): Add LEGACY_INDEX_REGS. Rename LEGACY_REGS to LEGACY_GENERAL_REGS. (REG_CLASS_NAMES): Ditto. (REG_CLASS_CONTENTS): Ditto. * config/i386/constraints.md ("R"): Update for rename.
2023-11-05mode-switching: Remove unused bbnum fieldRichard Sandiford1-13/+5
seginfo had an unused bbnum field, presumably dating from before BB information was attached directly to insns. gcc/ * mode-switching.cc: Remove unused forward references. (seginfo): Remove bbnum. (new_seginfo): Remove associated argument. (optimize_mode_switching): Update calls accordingly.
2023-11-05read-rtl: Fix infinite loop while parsing [...]Richard Sandiford1-1/+3
read_rtx_operand would spin endlessly for: (unspec [(...))] UNSPEC_FOO) because read_nested_rtx does nothing if the next character is not '('. gcc/ * read-rtl.cc (read_rtx_operand): Avoid spinning endlessly for invalid [...] operands.
2023-11-05openmp: Adjust handling of __has_attribute (omp::directive)/sequence and add ↵Jakub Jelinek4-189/+115
omp::decl I forgot to tweak c_common_has_attribute for the C++ omp::decl addition and now also for the C omp::{directive,sequence,decl} addition. 2023-11-05 Jakub Jelinek <jakub@redhat.com> * c-lex.cc (c_common_has_attribute): Return 1 for omp::directive and omp::sequence with -fopenmp or -fopenmp-simd also for C, not just for C++. Return 1 for omp::decl with -fopenmp or -fopenmp-simd for both C and C++. * c-c++-common/gomp/attrs-1.c: Adjust for omp::directive and omp::sequence being supported also in C and add tests for omp::decl. * c-c++-common/gomp/attrs-2.c: Likewise. * c-c++-common/gomp/attrs-3.c: Add tests for omp::decl.
2023-11-05aarch64: Rework aarch64_modes_tieable_p [PR112105]Richard Sandiford3-111/+147
On AArch64, can_change_mode_class and modes_tieable_p are mostly answering the same questions: (a) Do two modes have the same layout for the bytes that are common to both modes? (b) Do all valid subregs involving the two modes behave as GCC would expect? (c) Is there at least one register that can hold both modes? These questions involve no class-dependent tests, and the relationship is symmetrical. This means we can do most of the checks in a common subroutine. can_change_mode_class is the hook that matters for correctness, while modes_tieable_p is more for optimisation. It was therefore can_change_mode_class that had the more accurate tests. modes_tieable_p was looser in some ways (e.g. it missed some big-endian tests) and overly strict in others (it didn't allow ties between a vector structure mode and the mode of a single lane). The overly strict part caused a missed combination in the testcase. I think the can_change_mode_class logic also needed some tweaks, as described in the changelog. gcc/ PR target/112105 * config/aarch64/aarch64.cc (aarch64_modes_compatible_p): New function, with the core logic extracted from... (aarch64_can_change_mode_class): ...here. Extend the previous rules to allow changes between partial SVE modes and other modes if the other mode is no bigger than an element, and if no other rule prevents it. Use the aarch64_modes_tieable_p handling of partial Advanced SIMD structure modes. (aarch64_modes_tieable_p): Use aarch64_modes_compatible_p. Allow all vector mode ties that it allows. gcc/testsuite/ PR target/112105 * gcc.target/aarch64/pr112105.c: New test. * gcc.target/aarch64/sve/pcs/struct_3_128.c: Expect a 32-bit spill rather than a 16-bit spill.
2023-11-05RISC-V: Support FP rint to i/l/ll diff size autovecPan Li16-56/+514
This patch would like to support the FP below API auto vectorization with different type size +---------+-----------+----------+ | API | RV64 | RV32 | +---------+-----------+----------+ | irint | DF => SI | DF => SI | | irintf | - | - | | lrint | - | DF => SI | | lrintf | SF => DI | - | | llrint | - | - | | llrintf | SF => DI | SF => DI | +---------+-----------+----------+ Given below code: void test_lrintf (long *out, float *in, unsigned count) { for (unsigned i = 0; i < count; i++) out[i] = __builtin_lrintf (in[i]); } Before this patch: test_lrintf: beq a2,zero,.L8 slli a5,a2,32 srli a2,a5,30 add a4,a1,a2 .L3: flw fa5,0(a1) addi a1,a1,4 addi a0,a0,8 fcvt.l.s a5,fa5,dyn sd a5,-8(a0) bne a1,a4,.L3 After this patch: test_lrintf: beq a2,zero,.L8 slli a2,a2,32 srli a2,a2,32 .L3: vsetvli a5,a2,e32,mf2,ta,ma vle32.v v2,0(a1) slli a3,a5,2 slli a4,a5,3 vfwcvt.x.f.v v1,v2 sub a2,a2,a5 vse64.v v1,0(a0) add a1,a1,a3 add a0,a0,a4 bne a2,zero,.L3 Unfortunately, the HF mode is not include due to it requires additional middle-end support from internal-fun.def. gcc/ChangeLog: * config/riscv/autovec.md: Remove the size check of lrint. * config/riscv/riscv-v.cc (emit_vec_narrow_cvt_x_f): New help emit func impl. (emit_vec_widden_cvt_x_f): New help emit func impl. (emit_vec_rounding_to_integer): New func impl to emit the rounding from FP to integer. (expand_vec_lrint): Leverage emit_vec_rounding_to_integer. * config/riscv/vector.md: Take V_VLSF for vfncvt. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/unop/math-irint-run-0.c: * gcc.target/riscv/rvv/autovec/unop/math-irint-1.c: New test. * gcc.target/riscv/rvv/autovec/unop/math-irintf-run-0.c: New test. * gcc.target/riscv/rvv/autovec/unop/math-llrintf-0.c: New test. * gcc.target/riscv/rvv/autovec/unop/math-llrintf-run-0.c: New test. * gcc.target/riscv/rvv/autovec/unop/math-lrint-rv32-0.c: New test. * gcc.target/riscv/rvv/autovec/unop/math-lrint-rv32-run-0.c: New test. * gcc.target/riscv/rvv/autovec/unop/math-lrintf-rv64-0.c: New test. * gcc.target/riscv/rvv/autovec/unop/math-lrintf-rv64-run-0.c: New test. * gcc.target/riscv/rvv/autovec/vls/math-irint-1.c: New test. * gcc.target/riscv/rvv/autovec/vls/math-llrintf-0.c: New test. * gcc.target/riscv/rvv/autovec/vls/math-lrint-rv32-0.c: New test. * gcc.target/riscv/rvv/autovec/vls/math-lrintf-rv64-0.c: New test. Signed-off-by: Pan Li <pan2.li@intel.com>
2023-11-05RISC-V: Fix bug of vlds attributeJuzhe-Zhong1-1/+1
This issue is noticed when support strided load/store auto-vectorization. Commit it as it is obvious. gcc/ChangeLog: * config/riscv/vector.md: Fix bug.
2023-11-05Daily bump.GCC Administrator11-1/+524
2023-11-04diagnostics: fix gcc-urlifier.cc bootstrap failure [PR112379]Sergei Trofimovich1-1/+2
Without the change `./configure --enable-checking=release` bootstrap fails as: gcc/gcc-urlifier.cc:100:1: error: 'get_url_suffix_for_quoted_text()' defined but not used [-Werror=unused-function] This happens because the helper is used only in `ASSERT` macros which don't always get expanded to executable code. The fix marks helper function with `ATTRIBUTE_UNUSED`. gcc/ PR bootstrap/112379 * gcc-urlifier.cc (get_url_suffix_for_quoted_text): Mark as ATTRIBUTE_UNUSED.
2023-11-04openmp: Add omp::decl support for C2XJakub Jelinek6-8/+394
This patch adds omp::decl support which has been added recently for C++ also to C. 2023-11-04 Jakub Jelinek <jakub@redhat.com> * c-parser.h (c_maybe_parse_omp_decl): Declare. * c-parser.cc (struct c_parser): Add in_omp_decl_attribute member. (c_parser_std_attribute): Uncoment omp::decl handling. (c_parser_omp_var_list_parens): If parser->in_omp_decl_attribute don't expect any arguments, instead create clause or TREE_LIST for that decl. (c_maybe_parse_omp_decl): New function. (c_parser_omp_declare_target): If parser->in_omp_decl_attribute and first token isn't name or comma invoke c_parser_omp_var_list_parens. * c-decl.cc (c_decl_attributes): Uncomment omp::decl handling and use *node rather than non-existing *decl. * gcc.dg/gomp/attrs-19.c: New test. * gcc.dg/gomp/attrs-20.c: New test. * gcc.dg/gomp/attrs-21.c: New test.
2023-11-04openmp: Add support for omp::directive and omp::sequence attributes in C2XJakub Jelinek32-81/+1767
The following patch adds support for attribute syntax which we have in C++11 and above since GCC 12 also for C, where OpenMP standard is going to add it in OpenMP 6.0. 2023-11-04 Jakub Jelinek <jakub@redhat.com> gcc/c/ * c-tree.def: New file. * c-tree.h (struct c_tree_token_vec): Forward declare. (c_tree_size): Declare. * c-lang.h (struct c_omp_declare_target_attr): Add attr_syntax member. (struct c_omp_begin_assumes_data): New type. (current_omp_begin_assumes): Change type from int to vec<c_omp_begin_assumes_data, va_gc> *. * c-lang.cc: Include c-family/c-pragma.h and c-parser.h. * c-parser.h (struct c_tree_token_vec_struct): New type. (C_TOKEN_VEC_TOKENS): New macro. * c-parser.cc (struct c_parser): Add omp_attrs_forbidden_p and in_omp_attribute_pragma members. (c_parser_skip_until_found): Handle CPP_PRAGMA_EOL when parser->in_omp_attribute_pragma. (c_parser_skip_to_pragma_eol): Likewise. (c_parser_translation_unit): Adjust for current_omp_begin_assumes being a vector rather than counter. (c_parser_declaration_or_fndef): Handle omp::directive and omp::sequence attributes on attribute declaration and declare simd or declare variant directives in those on function declarations. (c_parser_check_balanced_raw_token_sequence): Forward declare. (c_parser_omp_directive_args, c_parser_omp_sequence_args): New functions. (c_parser_std_attribute): Handle omp::directive and omp::sequence attributes. (struct c_omp_attribute_data): New type. (c_parser_handle_statement_omp_attributes, c_parser_handle_directive_omp_attributes): New functions. (c_parser_compound_statement_nostart): Handle omp::directive and omp::sequence attributes on statements. Formatting fix. (c_parser_all_labels): Handle omp::directive and omp::sequence attributes on statements. (c_parser_statement): Clear parser->omp_attrs_forbidden_p. (c_parser_omp_variable_list): Handle parser->tokens != &parser->tokens_buf[0] by saving/restoring it. (c_parser_omp_structured_block): Set parser->omp_attrs_forbidden_p. (c_parser_omp_section_scan): New function. (c_parser_omp_structured_block_sequence, c_parser_omp_sections_scope): Use it. (c_parser_omp_parallel): Set parser->omp_attrs_forbidden_p. (c_parser_omp_task): Likewise. (c_parser_omp_declare_simd): Handle function declaration after std attributes. (c_finish_omp_declare_simd): Don't assert all kinds are the same. (c_parser_omp_declare_target): Also push attr_syntax flag. (c_parser_omp_begin): Likewise. Adjust for current_omp_begin_assumes type change. (c_parser_omp_end): Adjust for current_omp_begin_assumes type change. Diagnose mixing of attribute vs. pragma syntax on end assumes or end declare target. (c_parser_omp_declare_reduction): Handle parser->tokens != &parser->tokens_buf[0] by saving/restoring it. * c-decl.cc: Include c-parser.h. (current_omp_begin_assumes): Change type from int to vec<c_omp_begin_assumes_data, va_gc> *. (struct c_tree_token_vec): New type. Add static assertions for sizeof and offsetof. (union lang_tree_node): Add c_token_vec member and adjust GTY desc for it. (c_tree_size): New function. (c_decl_attributes): Diagnose invalid omp::directive attribute uses. * c-objc-common.h (LANG_HOOKS_TREE_SIZE): Redefine. gcc/cp/ * parser.h (struct cp_parser): Adjust comment on omp_attrs_forbidden_p member. * parser.cc (cp_parser_omp_section_scan): Allow __directive__ spelling. gcc/objc/ * objc-act.h (objc_common_tree_size): Remove. * objc-act.cc (objc_common_tree_size): Remove. * objc-lang.cc (LANG_HOOKS_TREE_SIZE): Remove. gcc/testsuite/ * gcc.dg/gomp/attrs-1.c: New test. * gcc.dg/gomp/attrs-2.c: New test. * gcc.dg/gomp/attrs-3.c: New test. * gcc.dg/gomp/attrs-4.c: New test. * gcc.dg/gomp/attrs-5.c: New test. * gcc.dg/gomp/attrs-6.c: New test. * gcc.dg/gomp/attrs-7.c: New test. * gcc.dg/gomp/attrs-8.c: New test. * gcc.dg/gomp/attrs-9.c: New test. * gcc.dg/gomp/attrs-10.c: New test. * gcc.dg/gomp/attrs-11.c: New test. * gcc.dg/gomp/attrs-12.c: New test. * gcc.dg/gomp/attrs-13.c: New test. * gcc.dg/gomp/attrs-14.c: New test. * gcc.dg/gomp/attrs-15.c: New test. * gcc.dg/gomp/attrs-16.c: New test. * gcc.dg/gomp/attrs-17.c: New test. * gcc.dg/gomp/attrs-18.c: New test. * g++.dg/gomp/attrs-2.C: Enable for c++11 rather than just c++17. Avoid using omp : syntax for c++11, c++14 and c.
2023-11-04RISC-V: Remove HF modes of FP to INT rounding autovecPan Li1-57/+2
The [i|l|ll][rint|round|ceil|floor] internal functions are defined as DEF_INTERNAL_FLT_FN instead of DEF_INTERNAL_FLT_FLOATN_FN. Then the *f16 (N=16 of FLOATN) format of these functions are not available when try to get the ifn from the given cfn in the vectorizable_call. Aka: BUILT_IN_LRINTF16 => IFN_LAST (should be IFN_LRINT here) BUILT_IN_RINTF16 => IFN_RINT It is better to remove FP16 related modes until the additional middle-end support is ready. This patch would like to clean the FP16 modes with some comments. gcc/ChangeLog: * config/riscv/vector-iterators.md: Remove HF modes. Signed-off-by: Pan Li <pan2.li@intel.com>
2023-11-03diagnostics: add automatic URL-ification within messagesDavid Malcolm14-11/+498
In r10-3781-gd26082357676a3 GCC's pretty-print framework gained the ability to emit embedding URLs via escape sequences for marking up text output.. In r10-3783-gb4c7ca2ef3915a GCC started using this for the [-Wname-of-option] emitted at the end of each diagnostic so that it becomes a hyperlink to the documentation for that option on the GCC website. This makes it much more convenient for the user to locate pertinent documentation when a diagnostic is emitted. The above involved special-casing in one specific place, but there is plenty of quoted text throughout GCC's diagnostic messages that could usefully have a documentation URL: references to options, pragmas, etc This patch adds a new optional "urlifier" parameter to pp_format. The idea is that a urlifier object has responsibility for mapping from quoted strings in diagnostic messages to URLs, and pp_format has the ability to automatically add URL escapes for strings that the urlifier gives it URLs for. For example, given the format string: "%<#pragma pack%> has no effect with %<-fpack-struct%>" with this patch GCC is able to automatically linkify the "#pragma pack" text to https://gcc.gnu.org/onlinedocs/gcc/Structure-Layout-Pragmas.html and the "-fpack-struct" text to: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#index-fpack-struct and we don't have to modify the format string itself. This is only done for the pp_format within diagnostic_context::report_diagnostic i.e. just for the primary message in each diagnostics, and not for other places within GCC that use pp format internally. "urlifier" is an abstract base class, with a GCC-specific subclass implementing the logic for generating URLs into GCC's HTML documentation via binary search in a data table. This patch implements the gcc_urlifier with a small table generated by hand; the data table in this patch only covers various pragmas and the option referenced by the above pragma message. I have a followup patch that scripts the creation of this data by directly scraping the output of "make html", thus automating all this, and (I hope) minimizing the work of ensuring that documentation URLs emitted by GCC match the generated documentation. gcc/ChangeLog: * Makefile.in (GCC_OBJS): Add gcc-urlifier.o. (OBJS): Likewise. gcc/c-family/ChangeLog: * c-pragma.cc:: (handle_pragma_push_options): Fix missing "GCC" in name of pragma in "junk" message. (handle_pragma_pop_options): Likewise. gcc/ChangeLog: * diagnostic.cc: Include "pretty-print-urlifier.h". (diagnostic_context::initialize): Initialize m_urlifier. (diagnostic_context::finish): Clean up m_urlifier (diagnostic_report::diagnostic): m_urlifier to pp_format. * diagnostic.h (diagnostic_context::m_urlifier): New field. * gcc-urlifier.cc: New file. * gcc-urlifier.def: New file. * gcc-urlifier.h: New file. * gcc.cc: Include "gcc-urlifier.h". (driver::global_initializations): Initialize global_dc->m_urlifier. * pretty-print-urlifier.h: New file. * pretty-print.cc: Include "pretty-print-urlifier.h". (obstack_append_string): New. (urlify_quoted_string): New. (pp_format): Add "urlifier" param and use it to implement optional urlification of quoted text strings. (pp_output_formatted_text): Make buffer a const pointer. (selftest::pp_printf_with_urlifier): New. (selftest::test_urlification): New. (selftest::pretty_print_cc_tests): Call it. * pretty-print.h (class urlifier): New forward declaration. (pp_format): Add optional urlifier param. * selftest-run-tests.cc (selftest::run_tests): Call selftest::gcc_urlifier_cc_tests . * selftest.h (selftest::gcc_urlifier_cc_tests): New decl. * toplev.cc: Include "gcc-urlifier.h". (general_init): Initialize global_dc->m_urlifier. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2023-11-03diagnostics: convert diagnostic_context to a classDavid Malcolm37-689/+851
This patch: - converts "struct diagnostic_context" to "class diagnostic_context". - ensures all data members have an "m_" prefix, except for "printer", which has so many uses that renaming would be painful. - makes most of the data members private - converts much of the diagnostic_* functions to member functions of diagnostic_context, adding compatibility wrappers for users such as the Fortran frontend, and making as many as possible private. No functional change intended. gcc/ChangeLog: * common.opt (fdiagnostics-text-art-charset=): Remove refererence to diagnostic-text-art.h. * coretypes.h (struct diagnostic_context): Replace forward decl with... (class diagnostic_context): ...this. * diagnostic-format-json.cc: Update for changes to diagnostic_context. * diagnostic-format-sarif.cc: Likewise. * diagnostic-show-locus.cc: Likewise. * diagnostic-text-art.h: Deleted file, moving content... (enum diagnostic_text_art_charset): ...to diagnostic.h, (DIAGNOSTICS_TEXT_ART_CHARSET_DEFAULT): ...deleting, (diagnostics_text_art_charset_init): ...deleting in favor of diagnostic_context::set_text_art_charset. * diagnostic.cc: Remove include of "diagnostic-text-art.h". (pedantic_warning_kind): Update for field renaming. (permissive_error_kind): Likewise. (permissive_error_option): Likewise. (diagnostic_initialize): Convert to... (diagnostic_context::initialize): ...this, updating for field renamings. (diagnostic_color_init): Convert to... (diagnostic_context::color_init): ...this. (diagnostic_urls_init): Convert to... (diagnostic_context::urls_init): ...this. (diagnostic_initialize_input_context): Convert to... (diagnostic_context::initialize_input_context): ...this. (diagnostic_finish): Convert to... (diagnostic_context::finish): ...this, updating for field renamings. (diagnostic_context::set_output_format): New. (diagnostic_context::set_client_data_hooks): New. (diagnostic_context::create_edit_context): New. (diagnostic_converted_column): Convert to... (diagnostic_context::converted_column): ...this. (diagnostic_get_location_text): Update for field renaming. (diagnostic_check_max_errors): Convert to... (diagnostic_context::check_max_errors): ...this, updating for field renamings. (diagnostic_action_after_output): Convert to... (diagnostic_context::action_after_output): ...this, updating for field renamings. (last_module_changed_p): Delete. (set_last_module): Delete. (includes_seen): Convert to... (diagnostic_context::includes_seen_p): ...this, updating for field renamings. (diagnostic_report_current_module): Convert to... (diagnostic_context::report_current_module): ...this, updating for field renamings, and replacing uses of last_module_changed_p and set_last_module to simple field accesses. (diagnostic_show_any_path): Convert to... (diagnostic_context::show_any_path): ...this. (diagnostic_classify_diagnostic): Convert to... (diagnostic_context::classify_diagnostic): ...this, updating for field renamings. (diagnostic_push_diagnostics): Convert to... (diagnostic_context::push_diagnostics): ...this, updating for field renamings. (diagnostic_pop_diagnostics): Convert to... (diagnostic_context::pop_diagnostics): ...this, updating for field renamings. (get_any_inlining_info): Convert to... (diagnostic_context::get_any_inlining_info): ...this, updating for field renamings. (update_effective_level_from_pragmas): Convert to... (diagnostic_context::update_effective_level_from_pragmas): ...this, updating for field renamings. (print_any_cwe): Convert to... (diagnostic_context::print_any_cwe): ...this. (print_any_rules): Convert to... (diagnostic_context::print_any_rules): ...this. (print_option_information): Convert to... (diagnostic_context::print_option_information): ...this, updating for field renamings. (diagnostic_enabled): Convert to... (diagnostic_context::diagnostic_enabled): ...this, updating for field renamings. (warning_enabled_at): Convert to... (diagnostic_context::warning_enabled_at): ...this. (diagnostic_report_diagnostic): Convert to... (diagnostic_context::report_diagnostic): ...this, updating for field renamings and conversions to member functions. (diagnostic_append_note): Update for field renaming. (diagnostic_impl): Use diagnostic_context::report_diagnostic directly. (diagnostic_n_impl): Likewise. (diagnostic_emit_diagram): Convert to... (diagnostic_context::emit_diagram): ...this, updating for field renamings. (error_recursion): Convert to... (diagnostic_context::error_recursion): ...this. (diagnostic_text_output_format::~diagnostic_text_output_format): Use accessor. (diagnostics_text_art_charset_init): Convert to... (diagnostic_context::set_text_art_charset): ...this. (assert_location_text): Update for field renamings. * diagnostic.h (enum diagnostic_text_art_charset): Move here from diagnostic-text-art.h. (struct diagnostic_context): Convert to... (class diagnostic_context): ...this. (diagnostic_context::ice_handler_callback_t): New typedef. (diagnostic_context::set_locations_callback_t): New typedef. (diagnostic_context::initialize): New decl. (diagnostic_context::color_init): New decl. (diagnostic_context::urls_init): New decl. (diagnostic_context::file_cache_init): New decl. (diagnostic_context::finish): New decl. (diagnostic_context::set_set_locations_callback): New. (diagnostic_context::initialize_input_context): New decl. (diagnostic_context::warning_enabled_at): New decl. (diagnostic_context::option_unspecified_p): New. (diagnostic_context::report_diagnostic): New decl. (diagnostic_context::report_current_module): New decl. (diagnostic_context::check_max_errors): New decl. (diagnostic_context::action_after_output): New decl. (diagnostic_context::classify_diagnostic): New decl. (diagnostic_context::push_diagnostics): New decl. (diagnostic_context::pop_diagnostics): New decl. (diagnostic_context::emit_diagram): New decl. (diagnostic_context::set_output_format): New decl. (diagnostic_context::set_text_art_charset): New decl. (diagnostic_context::set_client_data_hooks): New decl. (diagnostic_context::create_edit_context): New decl. (diagnostic_context::set_warning_as_error_requested): New. (diagnostic_context::set_report_bug): New. (diagnostic_context::set_extra_output_kind): New. (diagnostic_context::set_show_cwe): New. (diagnostic_context::set_show_rules): New. (diagnostic_context::set_path_format): New. (diagnostic_context::set_show_path_depths): New. (diagnostic_context::set_show_option_requested): New. (diagnostic_context::set_max_errors): New. (diagnostic_context::set_escape_format): New. (diagnostic_context::set_ice_handler_callback): New. (diagnostic_context::warning_as_error_requested_p): New. (diagnostic_context::show_path_depths_p): New. (diagnostic_context::get_path_format): New. (diagnostic_context::get_escape_format): New. (diagnostic_context::get_file_cache): New. (diagnostic_context::get_edit_context): New. (diagnostic_context::get_client_data_hooks): New. (diagnostic_context::get_diagram_theme): New. (diagnostic_context::converted_column): New decl. (diagnostic_context::diagnostic_count): New. (diagnostic_context::includes_seen_p): New decl. (diagnostic_context::print_any_cwe): New decl. (diagnostic_context::print_any_rules): New decl. (diagnostic_context::print_option_information): New decl. (diagnostic_context::show_any_path): New decl. (diagnostic_context::error_recursion): New decl. (diagnostic_context::diagnostic_enabled): New decl. (diagnostic_context::get_any_inlining_info): New decl. (diagnostic_context::update_effective_level_from_pragmas): New decl. (diagnostic_context::m_file_cache): Make private. (diagnostic_context::diagnostic_count): Rename to... (diagnostic_context::m_diagnostic_count): ...this and make private. (diagnostic_context::warning_as_error_requested): Rename to... (diagnostic_context::m_warning_as_error_requested): ...this and make private. (diagnostic_context::n_opts): Rename to... (diagnostic_context::m_n_opts): ...this and make private. (diagnostic_context::classify_diagnostic): Rename to... (diagnostic_context::m_classify_diagnostic): ...this and make private. (diagnostic_context::classification_history): Rename to... (diagnostic_context::m_classification_history): ...this and make private. (diagnostic_context::n_classification_history): Rename to... (diagnostic_context::m_n_classification_history): ...this and make private. (diagnostic_context::push_list): Rename to... (diagnostic_context::m_push_list): ...this and make private. (diagnostic_context::n_push): Rename to... (diagnostic_context::m_n_push): ...this and make private. (diagnostic_context::show_cwe): Rename to... (diagnostic_context::m_show_cwe): ...this and make private. (diagnostic_context::show_rules): Rename to... (diagnostic_context::m_show_rules): ...this and make private. (diagnostic_context::path_format): Rename to... (diagnostic_context::m_path_format): ...this and make private. (diagnostic_context::show_path_depths): Rename to... (diagnostic_context::m_show_path_depths): ...this and make private. (diagnostic_context::show_option_requested): Rename to... (diagnostic_context::m_show_option_requested): ...this and make private. (diagnostic_context::abort_on_error): Rename to... (diagnostic_context::m_abort_on_error): ...this. (diagnostic_context::show_column): Rename to... (diagnostic_context::m_show_column): ...this. (diagnostic_context::pedantic_errors): Rename to... (diagnostic_context::m_pedantic_errors): ...this. (diagnostic_context::permissive): Rename to... (diagnostic_context::m_permissive): ...this. (diagnostic_context::opt_permissive): Rename to... (diagnostic_context::m_opt_permissive): ...this. (diagnostic_context::fatal_errors): Rename to... (diagnostic_context::m_fatal_errors): ...this. (diagnostic_context::dc_inhibit_warnings): Rename to... (diagnostic_context::m_inhibit_warnings): ...this. (diagnostic_context::dc_warn_system_headers): Rename to... (diagnostic_context::m_warn_system_headers): ...this. (diagnostic_context::max_errors): Rename to... (diagnostic_context::m_max_errors): ...this and make private. (diagnostic_context::internal_error): Rename to... (diagnostic_context::m_internal_error): ...this. (diagnostic_context::option_enabled): Rename to... (diagnostic_context::m_option_enabled): ...this. (diagnostic_context::option_state): Rename to... (diagnostic_context::m_option_state): ...this. (diagnostic_context::option_name): Rename to... (diagnostic_context::m_option_name): ...this. (diagnostic_context::get_option_url): Rename to... (diagnostic_context::m_get_option_url): ...this. (diagnostic_context::print_path): Rename to... (diagnostic_context::m_print_path): ...this. (diagnostic_context::make_json_for_path): Rename to... (diagnostic_context::m_make_json_for_path): ...this. (diagnostic_context::x_data): Rename to... (diagnostic_context::m_client_aux_data): ...this. (diagnostic_context::last_location): Rename to... (diagnostic_context::m_last_location): ...this. (diagnostic_context::last_module): Rename to... (diagnostic_context::m_last_module): ...this and make private. (diagnostic_context::lock): Rename to... (diagnostic_context::m_lock): ...this and make private. (diagnostic_context::lang_mask): Rename to... (diagnostic_context::m_lang_mask): ...this. (diagnostic_context::inhibit_notes_p): Rename to... (diagnostic_context::m_inhibit_notes_p): ...this. (diagnostic_context::report_bug): Rename to... (diagnostic_context::m_report_bug): ...this and make private. (diagnostic_context::extra_output_kind): Rename to... (diagnostic_context::m_extra_output_kind): ...this and make private. (diagnostic_context::column_unit): Rename to... (diagnostic_context::m_column_unit): ...this and make private. (diagnostic_context::column_origin): Rename to... (diagnostic_context::m_column_origin): ...this and make private. (diagnostic_context::tabstop): Rename to... (diagnostic_context::m_tabstop): ...this and make private. (diagnostic_context::escape_format): Rename to... (diagnostic_context::m_escape_format): ...this and make private. (diagnostic_context::edit_context_ptr): Rename to... (diagnostic_context::m_edit_context_ptr): ...this and make private. (diagnostic_context::set_locations_cb): Rename to... (diagnostic_context::m_set_locations_cb): ...this and make private. (diagnostic_context::ice_handler_cb): Rename to... (diagnostic_context::m_ice_handler_cb): ...this and make private. (diagnostic_context::includes_seen): Rename to... (diagnostic_context::m_includes_seen): ...this and make private. (diagnostic_inhibit_notes): Update for field renaming. (diagnostic_context_auxiliary_data): Likewise. (diagnostic_abort_on_error): Convert from macro to inline function and update for field renaming. (diagnostic_kind_count): Convert from macro to inline function and use diagnostic_count accessor. (diagnostic_report_warnings_p): Update for field renaming. (diagnostic_initialize): Convert decl to inline function calling into diagnostic_context. (diagnostic_color_init): Likewise. (diagnostic_urls_init): Likewise. (diagnostic_urls_init): Likewise. (diagnostic_finish): Likewise. (diagnostic_report_current_module): Likewise. (diagnostic_show_any_path): Delete decl. (diagnostic_initialize_input_context): Convert decl to inline function calling into diagnostic_context. (diagnostic_classify_diagnostic): Likewise. (diagnostic_push_diagnostics): Likewise. (diagnostic_pop_diagnostics): Likewise. (diagnostic_report_diagnostic): Likewise. (diagnostic_action_after_output): Likewise. (diagnostic_check_max_errors): Likewise. (diagnostic_file_cache_fini): Delete decl. (diagnostic_converted_column): Delete decl. (warning_enabled_at): Convert decl to inline function calling into diagnostic_context. (option_unspecified_p): New. (diagnostic_emit_diagram): Delete decl. * gcc.cc: Remove include of "diagnostic-text-art.h". Update for changes to diagnostic_context. * input.cc (diagnostic_file_cache_init): Move implementation to... (diagnostic_context::file_cache_init): ...this new member function. (diagnostic_file_cache_fini): Delete. (diagnostics_file_cache_forcibly_evict_file): Update for m_file_cache becoming private. (location_get_source_line): Likewise. (get_source_file_content): Likewise. (location_missing_trailing_newline): Likewise. * input.h (diagnostics_file_cache_fini): Delete. * langhooks.cc: Update for changes to diagnostic_context. * lto-wrapper.cc: Likewise. * opts.cc: Remove include of "diagnostic-text-art.h". Update for changes to diagnostic_context. * selftest-diagnostic.cc: Update for changes to diagnostic_context. * toplev.cc: Likewise. * tree-diagnostic-path.cc: Likewise. * tree-diagnostic.cc: Likewise. gcc/ada/ChangeLog: * gcc-interface/misc.cc: Update for changes to diagnostic_context. gcc/analyzer/ChangeLog: * bounds-checking.cc: Update for changes to diagnostic_context. gcc/c-family/ChangeLog: * c-common.cc: Update for changes to diagnostic_context. * c-indentation.cc: Likewise. * c-opts.cc: Likewise. * c-warn.cc: Likewise. gcc/cp/ChangeLog: * call.cc: Update for changes to diagnostic_context. * class.cc: Likewise. * decl.cc: Likewise. * error.cc: Likewise. * except.cc: Likewise. * pt.cc: Likewise. gcc/fortran/ChangeLog: * cpp.cc: Update for changes to diagnostic_context. * error.cc: Likewise. * options.cc: Likewise. gcc/jit/ChangeLog: * jit-playback.cc: Update for changes to diagnostic_context. * jit-playback.h: Likewise. gcc/testsuite/ChangeLog: * gcc.dg/plugin/diagnostic_group_plugin.c: Update for changes to diagnostic_context. * gcc.dg/plugin/diagnostic_plugin_test_text_art.c: Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2023-11-04Daily bump.GCC Administrator4-1/+322
2023-11-03Reduce false positives for -Wnonnull for VLA parameters [PR98541]Martin Uecker3-36/+27
This patch limits the warning about NULL arguments to VLA parameters declared [static n]. PR c/98541 gcc/ * gimple-ssa-warn-access.cc (pass_waccess::maybe_check_access_sizes): For VLA bounds in parameters, only warn about null pointers with 'static'. gcc/testsuite: * gcc.dg/Wnonnull-4.c: Adapt test. * gcc.dg/Wstringop-overflow-40.c: Adapt test.
2023-11-03Fortran: fix issue with multiple references of a procedure pointer [PR97245]Harald Anlauf2-0/+36
gcc/fortran/ChangeLog: PR fortran/97245 * match.cc (gfc_match_call): If a procedure pointer has already been resolved, do not create a new symbol in a procedure reference of the same name shadowing the first one if it is host-associated. gcc/testsuite/ChangeLog: PR fortran/97245 * gfortran.dg/proc_ptr_53.f90: New test.
2023-11-03vect: allow using inbranch simdclones for masked loopsAndre Vieira4-3/+97
In a previous patch I did most of the work for this, but forgot to change the check for number of arguments matching between call and simdclone. This check should accept calls without a mask to be matched against simdclones with mask arguments. I also added tests to verify this feature actually works. gcc/ChangeLog: * tree-vect-stmts.cc (vectorizable_simd_clone_call): Allow unmasked calls to use masked simdclones. gcc/testsuite/ChangeLog: * gcc.dg/vect/vect-simd-clone-20.c: New file. * gfortran.dg/simd-builtins-1.h: Adapt. * gfortran.dg/simd-builtins-6.f90: Adapt.
2023-11-03diagnostics: consolidate group-handling fields in diagnostic_contextDavid Malcolm2-19/+42
No functional change intended. gcc/ChangeLog: * diagnostic.cc (diagnostic_initialize): Update for consolidation of group-based fields. (diagnostic_report_diagnostic): Likewise. (diagnostic_context::begin_group): New, based on body of auto_diagnostic_group's ctor. (diagnostic_context::end_group): New, based on body of auto_diagnostic_group's dtor. (auto_diagnostic_group::auto_diagnostic_group): Convert to a call to begin_group. (auto_diagnostic_group::~auto_diagnostic_group): Convert to a call to end_group. * diagnostic.h (diagnostic_context::begin_group): New decl. (diagnostic_context::end_group): New decl. (diagnostic_context::diagnostic_group_nesting_depth): Rename to... (diagnostic_context::m_diagnostic_groups.m_nesting_depth): ...this. (diagnostic_context::diagnostic_group_emission_count): Rename to... (diagnostic_context::m_diagnostic_groups::m_emission_count): ...this. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2023-11-03Fortran: passing of allocatable/pointer arguments to OPTIONAL+VALUE [PR92887]Harald Anlauf2-3/+130
gcc/fortran/ChangeLog: PR fortran/92887 * trans-expr.cc (conv_cond_temp): Helper function for creation of a conditional temporary. (gfc_conv_procedure_call): Handle passing of allocatable or pointer actual argument to dummy with OPTIONAL + VALUE attribute. Actual arguments that are not allocated or associated are treated as not present. gcc/testsuite/ChangeLog: PR fortran/92887 * gfortran.dg/value_optional_1.f90: New test.
2023-11-03Adjust operators equal and not_equal to check bitmasks against constantsAndrew MacLeod3-4/+43
Check to see if a comparison to a constant can be determined to always be not-equal based on the bitmask. PR tree-optimization/111766 gcc/ * range-op.cc (operator_equal::fold_range): Check constants against the bitmask. (operator_not_equal::fold_range): Ditto. * value-range.h (irange_bitmask::member_p): New. gcc/testsuite/ * gcc.dg/pr111766.c: New.
2023-11-03Remove simple ranges from trailing zero bitmasks.Andrew MacLeod2-0/+32
During the intersection operation, it can be helpful to remove any low-end ranges when the bitmask has trailing zeros. This prevents obviously incorrect ranges from appearing without requiring a bitmask check. * value-range.cc (irange_bitmask::adjust_range): New. (irange::intersect_bitmask): Call adjust_range. * value-range.h (irange_bitmask::adjust_range): New prototype.
2023-11-03i386: Handle multiple address register classesUros Bizjak4-218/+255
The patch generalizes address register class handling to allow multiple register classes. For APX EGPR targets, some instructions do not support GPR32 registers, so it is necessary to limit address register set to avoid them. The same situation happens for instructions with high registers, where REX registers can not be used in the address, so the existing infrastructure can be adapted to also handle this case. The patch is mostly a mechanical rename of "gpr32" attribute to "addr" and introduces no functional changes, although it fixes a couple of inconsistent attribute values in passing. A follow-up patch will use the above infrastructure to limit address register class to legacy registers for instructions with high registers. gcc/ChangeLog: * config/i386/i386.cc (ix86_memory_address_use_extended_reg_class_p): Rename to ... (ix86_memory_address_reg_class): ... this. Generalize address register class handling to allow multiple address register classes. Return maximal class for unrecognized instructions. Improve comments. (ix86_insn_base_reg_class): Rewrite to handle multiple address register classes. (ix86_regno_ok_for_insn_base_p): Ditto. (ix86_insn_index_reg_class): Ditto. * config/i386/i386.md: Rename "gpr32" attribute to "addr" and substitute its values with "0" -> "gpr16", "1" -> "*". (addr): New attribute to limit allowed address register set. (gpr32): Remove. * config/i386/mmx.md: Rename "gpr32" attribute to "addr" and substitute its values with "0" -> "gpr16", "1" -> "*". * config/i386/sse.md: Ditto.
2023-11-03Testcases for vectorizer peelingRichard Biener2-0/+44
The following exercise otherwise not exercised paths in the vectorizer peeling code, resulting in CPU 2017 build ICEs when patching but no fallout in the testsuite. * gfortran.dg/20231103-1.f90: New testcase. * gfortran.dg/20231103-2.f90: Likewise.
2023-11-03Cleanup vectorizable_live_operationRichard Biener1-36/+17
During analyzing PR111950 I found the loop live operation code-gen odd, in particular only replacing a single PHI but then adjusting possibly remaining PHIs afterwards where there shouldn't really be any out-of-loop uses of the scalar in-loop def left. * tree-vect-loop.cc (vectorizable_live_operation): Simplify LC PHI replacement.
2023-11-03ARC: Improve DImode left shift by a single bit.Roger Sayle3-9/+66
This patch improves the code generated for x << 1 (and for x + x) when X is 64-bit DImode, using the same two instruction code sequence used for DImode addition. For the test case: long long foo(long long x) { return x << 1; } GCC -O2 currently generates the following code: foo: lsr r2,r0,31 asl_s r1,r1,1 asl_s r0,r0,1 j_s.d [blink] or_s r1,r1,r2 and on CPU without a barrel shifter, i.e. -mcpu=em foo: add.f 0,r0,r0 asl_s r1,r1 rlc r2,0 asl_s r0,r0 j_s.d [blink] or_s r1,r1,r2 with this patch (both with and without a barrel shifter): foo: add.f r0,r0,r0 j_s.d [blink] adc r1,r1,r1 A similar optimization is also applicable to H8300H, that could also use a two instruction sequence (plus rts) but currently GCC generates 16 instructions (plus an rts) for foo above. 2023-11-03 Roger Sayle <roger@nextmovesoftware.com> gcc/ChangeLog * config/arc/arc.md (addsi3): Fix GNU-style code formatting. (adddi3): Change define_expand to generate a *adddi3. (*adddi3): New define_insn_and_split to lower DImode additions during the split1 pass (after combine and before reload). (ashldi3): New define_expand to (only) generate *ashldi3_cnt1 for DImode left shifts by a single bit. (*ashldi3_cnt1): New define_insn_and_split to lower DImode left shifts by one bit to an *adddi3. gcc/testsuite/ChangeLog * gcc.target/arc/adddi3-1.c: New test case. * gcc.target/arc/ashldi3-1.c: Likewise.
2023-11-03aarch64: Remove unnecessary can_create_pseudo_p conditionRichard Sandiford1-1/+1
This patch removes a can_create_pseudo_p condition from *cmov_uxtw_insn_insv, bringing it in line with *cmov<mode>_insn_insv. The constraints correctly describe the requirements. gcc/ * config/aarch64/aarch64.md (*cmov_uxtw_insn_insv): Remove can_create_pseudo_p condition.
2023-11-03VECT: Support SLP for MASK_LEN_GATHER_LOAD with dummy maskJuzhe-Zhong2-5/+5
This patch fixes following FAILs for RVV: FAIL: gcc.dg/vect/vect-gather-1.c -flto -ffat-lto-objects scan-tree-dump vect "Loop contains only SLP stmts" FAIL: gcc.dg/vect/vect-gather-1.c scan-tree-dump vect "Loop contains only SLP stmts" Bootstrap on X86 and regtest passed. Ok for trunk ? PR tree-optimization/111721 gcc/ChangeLog: * tree-vect-slp.cc (vect_get_and_check_slp_defs): Support SLP for dummy mask -1. * tree-vect-stmts.cc (vectorizable_load): Ditto.
2023-11-03tree-optimization/112366 - remove assert for failed live lane code genRichard Biener1-6/+1
The following removes a bogus assert constraining the uses that could appear when a built from scalar defs SLP node constrains code generation in a way so earlier uses of the vector CTOR components fail to get vectorized. We can't really constrain the operation such use appears in. PR tree-optimization/112366 * tree-vect-loop.cc (vectorizable_live_operation): Remove assert.
2023-11-03Skip a number of 'g++.dg/tree-prof/' test cases for '-fno-exceptions' testingThomas Schwinge7-0/+7
Running 'make check' with: 'RUNTESTFLAGS=--target_board=unix/-fno-exceptions', 'error: exception handling disabled' is triggered for C++ 'throw' etc. usage, and per 'gcc/testsuite/lib/gcc-dg.exp:gcc-dg-prune': # If exceptions are disabled, mark tests expecting exceptions to be enabled # as unsupported. if { ![check_effective_target_exceptions_enabled] } { if [regexp "(^|\n)\[^\n\]*: error: exception handling disabled" $text] { return "::unsupported::exception handling disabled" } ..., which generally means: -PASS: [...] (test for excess errors) +UNSUPPORTED: [...]: exception handling disabled However, this doesn't work for 'g++.dg/tree-prof/' test cases. For example: [-PASS:-]{+UNSUPPORTED:+} g++.dg/tree-prof/indir-call-prof-2.C [-compilation, -fprofile-generate -D_PROFILE_GENERATE-]{+compilation: exception handling disabled+} [-PASS:-]{+UNRESOLVED:+} g++.dg/tree-prof/indir-call-prof-2.C execution, -fprofile-generate -D_PROFILE_GENERATE [-PASS:-]{+UNRESOLVED:+} g++.dg/tree-prof/indir-call-prof-2.C compilation, -fprofile-use -D_PROFILE_USE [-PASS:-]{+UNRESOLVED:+} g++.dg/tree-prof/indir-call-prof-2.C execution, -fprofile-use -D_PROFILE_USE Dependent tests turn UNRESOLVED if the first "compilation" runs into the expected 'UNSUPPORTED: [...] compile: exception handling disabled'. Specify 'dg-require-effective-target exceptions_enabled' for those test cases. gcc/testsuite/ * g++.dg/tree-prof/indir-call-prof-2.C: Specify 'dg-require-effective-target exceptions_enabled'. * g++.dg/tree-prof/partition1.C: Likewise. * g++.dg/tree-prof/partition2.C: Likewise. * g++.dg/tree-prof/partition3.C: Likewise. * g++.dg/tree-prof/pr51719.C: Likewise. * g++.dg/tree-prof/pr57451.C: Likewise. * g++.dg/tree-prof/pr59255.C: Likewise.
2023-11-03Skip a number of 'g++.dg/lto/' test cases for '-fno-exceptions' testingThomas Schwinge5-0/+6
Running 'make check' with: 'RUNTESTFLAGS=--target_board=unix/-fno-exceptions', 'error: exception handling disabled' is triggered for C++ 'throw' etc. usage, and per 'gcc/testsuite/lib/gcc-dg.exp:gcc-dg-prune': # If exceptions are disabled, mark tests expecting exceptions to be enabled # as unsupported. if { ![check_effective_target_exceptions_enabled] } { if [regexp "(^|\n)\[^\n\]*: error: exception handling disabled" $text] { return "::unsupported::exception handling disabled" } ..., which generally means: -PASS: [...] (test for excess errors) +UNSUPPORTED: [...]: exception handling disabled However, this doesn't work for "split files" test cases. For example: [-PASS:-]{+UNSUPPORTED:+} g++.dg/lto/20081109-1 cp_lto_20081109-1_0.o [-assemble, -fPIC -flto -flto-partition=1to1-]{+assemble: exception handling disabled+} [-PASS:-]{+UNRESOLVED:+} g++.dg/lto/20081109-1 cp_lto_20081109-1_0.o-cp_lto_20081109-1_0.o [-link,-]{+link+} -fPIC -flto -flto-partition=1to1 {+UNRESOLVED: g++.dg/lto/20081109-1 cp_lto_20081109-1_0.o-cp_lto_20081109-1_0.o execute -fPIC -flto -flto-partition=1to1+} The "compile"/"assemble" tests (either continue to work, or) result in the expected 'UNSUPPORTED: [...] compile: exception handling disabled', but dependent "link" and "execute" tests then turn UNRESOLVED. Specify 'dg-require-effective-target exceptions_enabled' for those test cases. gcc/testsuite/ * g++.dg/lto/20081109-1_0.C: Specify 'dg-require-effective-target exceptions_enabled'. * g++.dg/lto/20081109_0.C: Likewise. * g++.dg/lto/20091026-1_0.C: Likewise. * g++.dg/lto/pr87906_0.C: Likewise. * g++.dg/lto/pr88046_0.C: Likewise.
2023-11-03Skip a number of 'g++.dg/compat/' test cases for '-fno-exceptions' testingThomas Schwinge11-0/+22
Running 'make check' with: 'RUNTESTFLAGS=--target_board=unix/-fno-exceptions', 'error: exception handling disabled' is triggered for C++ 'throw' etc. usage, and per 'gcc/testsuite/lib/gcc-dg.exp:gcc-dg-prune': # If exceptions are disabled, mark tests expecting exceptions to be enabled # as unsupported. if { ![check_effective_target_exceptions_enabled] } { if [regexp "(^|\n)\[^\n\]*: error: exception handling disabled" $text] { return "::unsupported::exception handling disabled" } ..., which generally means: -PASS: [...] (test for excess errors) +UNSUPPORTED: [...]: exception handling disabled However, this doesn't work for "split files" test cases. For example: PASS: g++.dg/compat/eh/ctor1 cp_compat_main_tst.o compile [-PASS:-]{+UNSUPPORTED:+} g++.dg/compat/eh/ctor1 cp_compat_x_tst.o [-compile-]{+compile: exception handling disabled+} [-PASS:-]{+UNSUPPORTED:+} g++.dg/compat/eh/ctor1 cp_compat_y_tst.o [-compile-]{+compile: exception handling disabled+} [-PASS:-]{+UNRESOLVED:+} g++.dg/compat/eh/ctor1 cp_compat_x_tst.o-cp_compat_y_tst.o link [-PASS:-]{+UNRESOLVED:+} g++.dg/compat/eh/ctor1 cp_compat_x_tst.o-cp_compat_y_tst.o execute The "compile"/"assemble" tests (either continue to work, or) result in the expected 'UNSUPPORTED: [...] compile: exception handling disabled', but dependent "link" and "execute" tests then turn UNRESOLVED. Specify 'dg-require-effective-target exceptions_enabled' for those test cases. gcc/testsuite/ * g++.dg/compat/eh/ctor1_main.C: Specify 'dg-require-effective-target exceptions_enabled'. * g++.dg/compat/eh/ctor2_main.C: Likewise. * g++.dg/compat/eh/dtor1_main.C: Likewise. * g++.dg/compat/eh/filter1_main.C: Likewise. * g++.dg/compat/eh/filter2_main.C: Likewise. * g++.dg/compat/eh/new1_main.C: Likewise. * g++.dg/compat/eh/nrv1_main.C: Likewise. * g++.dg/compat/eh/spec3_main.C: Likewise. * g++.dg/compat/eh/template1_main.C: Likewise. * g++.dg/compat/eh/unexpected1_main.C: Likewise. * g++.dg/compat/init/array5_main.C: Likewise.
2023-11-03Skip a number of C++ test cases for '-fno-exceptions' testingThomas Schwinge46-0/+55
Running 'make check' with: 'RUNTESTFLAGS=--target_board=unix/-fno-exceptions', 'error: exception handling disabled' is triggered for C++ 'throw' etc. usage, and per 'gcc/testsuite/lib/gcc-dg.exp:gcc-dg-prune': # If exceptions are disabled, mark tests expecting exceptions to be enabled # as unsupported. if { ![check_effective_target_exceptions_enabled] } { if [regexp "(^|\n)\[^\n\]*: error: exception handling disabled" $text] { return "::unsupported::exception handling disabled" } ..., which generally means: -PASS: [...] (test for excess errors) +UNSUPPORTED: [...]: exception handling disabled However, if there are additional 'dg-error' etc. directives, these may regress PASS -> FAIL (or similar) -- if their associated diagnostics are precluded by 'error: exception handling disabled'. For example: PASS: g++.dg/cpp2a/explicit1.C (test for errors, line 43) PASS: g++.dg/cpp2a/explicit1.C (test for errors, line 47) [-PASS:-]{+FAIL:+} g++.dg/cpp2a/explicit1.C (test for errors, line 50) [-PASS:-]{+FAIL:+} g++.dg/cpp2a/explicit1.C (test for errors, line 51) PASS: g++.dg/cpp2a/explicit1.C (test for errors, line 52) PASS: g++.dg/cpp2a/explicit1.C (test for errors, line 53) PASS: g++.dg/cpp2a/explicit1.C (test for errors, line 59) [-PASS:-]{+UNSUPPORTED:+} g++.dg/cpp2a/explicit1.C [-(test for excess errors)-]{+: exception handling disabled+} Specify 'dg-require-effective-target exceptions_enabled' for those test cases. gcc/testsuite/ * g++.dg/cpp0x/catch1.C: Specify 'dg-require-effective-target exceptions_enabled'. * g++.dg/cpp0x/constexpr-throw.C: Likewise. * g++.dg/cpp1y/constexpr-89785-2.C: Likewise. * g++.dg/cpp1y/constexpr-throw.C: Likewise. * g++.dg/cpp1y/pr79393-3.C: Likewise. * g++.dg/cpp2a/consteval-memfn1.C: Likewise. * g++.dg/cpp2a/consteval11.C: Likewise. * g++.dg/cpp2a/consteval34.C: Likewise. * g++.dg/cpp2a/consteval9.C: Likewise. * g++.dg/cpp2a/explicit1.C: Likewise. * g++.dg/cpp2a/explicit2.C: Likewise. * g++.dg/cpp2a/explicit5.C: Likewise. * g++.dg/eh/builtin10.C: Likewise. * g++.dg/eh/builtin11.C: Likewise. * g++.dg/eh/builtin6.C: Likewise. * g++.dg/eh/builtin7.C: Likewise. * g++.dg/eh/builtin9.C: Likewise. * g++.dg/eh/dtor4.C: Likewise. * g++.dg/eh/pr42859.C: Likewise. * g++.dg/ext/stmtexpr25.C: Likewise. * g++.dg/ext/vla4.C: Likewise. * g++.dg/init/placement4.C: Likewise. * g++.dg/other/error32.C: Likewise. * g++.dg/parse/crash55.C: Likewise. * g++.dg/parse/pr31952-2.C: Likewise. * g++.dg/parse/pr31952-3.C: Likewise. * g++.dg/tm/noexcept-7.C: Likewise. * g++.dg/torture/pr43257.C: Likewise. * g++.dg/torture/pr56694.C: Likewise. * g++.dg/torture/pr81659.C: Likewise. * g++.dg/warn/Wcatch-value-1.C: Likewise. * g++.dg/warn/Wcatch-value-2.C: Likewise. * g++.dg/warn/Wcatch-value-3.C: Likewise. * g++.dg/warn/Wcatch-value-3b.C: Likewise. * g++.dg/warn/Wexceptions1.C: Likewise. * g++.dg/warn/Wexceptions3.C: Likewise. * g++.dg/warn/Winfinite-recursion-3.C: Likewise. * g++.dg/warn/Wreturn-6.C: Likewise. * g++.dg/warn/Wstringop-truncation-2.C: Likewise. * g++.dg/warn/Wterminate1.C: Likewise. * g++.old-deja/g++.eh/catch1.C: Likewise. * g++.old-deja/g++.eh/catch10.C: Likewise. * g++.old-deja/g++.eh/cond1.C: Likewise. * g++.old-deja/g++.eh/ctor1.C: Likewise. * g++.old-deja/g++.eh/throw2.C: Likewise. * g++.old-deja/g++.other/cond5.C: Likewise.
2023-11-03tree-optimization/112310 - code hoisting undefined behaviorRichard Biener2-8/+54
The following avoids hoisting expressions that may invoke undefined behavior and are not computed on all paths. This is realized by noting that we have to avoid materializing expressions as part of hoisting that are not part of the set of expressions we have found eligible for hoisting. Instead of picking the expression corresponding to the hoistable values from the first successor we now keep a union of the expressions so that hoisting can pick the expression that has its dependences fully hoistable. PR tree-optimization/112310 * tree-ssa-pre.cc (do_hoist_insertion): Keep the union of expressions, validate dependences are contained within the hoistable set before hoisting. * gcc.dg/torture/pr112310.c: New testcase.
2023-11-03Fortran: Defined operators with unlimited polymorphic args [PR98498]Paul Thomas2-0/+109
2023-11-03 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/98498 * interface.cc (upoly_ok): Defined operators using unlimited polymorphic formal arguments must not override the intrinsic operator use. gcc/testsuite/ PR fortran/98498 * gfortran.dg/interface_50.f90: New test.
2023-11-03RISC-V: Refactor prefix [I/L/LL] rounding API autovec iteratorPan Li2-38/+251
Update in v2: * Add mode size equal check to disable different mode size when expand, because the underlying codegen is not implemented yet. Original log: The previous rounding API start with i/l/ll only works on the same mode types. For example as below, and we arrange the iterator similar to fcvt. * SF => SI * DF => DI After we refined this limination from middle-end, these API can also vectorized with different type sizes, aka: * HF => SI, HF => DI * SF => DI, SF => SI * DF => SI, DF => DI Then the iterator cannot take care of this simply and this patch would like to re-arrange the iterator in two items. * V_VLS_F_CONVERT_SI: handle (HF, SF, DF) => SI * V_VLS_F_CONVERT_DI: handle (HF, SF, DF) => DI As well as related mode_attr to reconcile the new iterator. gcc/ChangeLog: * config/riscv/autovec.md (lrint<mode><v_i_l_ll_convert>2): Remove. (lround<mode><v_i_l_ll_convert>2): Ditto. (lceil<mode><v_i_l_ll_convert>2): Ditto. (lfloor<mode><v_i_l_ll_convert>2): Ditto. (lrint<mode><v_f2si_convert>2): New pattern for cvt from FP to SI. (lround<mode><v_f2si_convert>2): Ditto. (lceil<mode><v_f2si_convert>2): Ditto. (lfloor<mode><v_f2si_convert>2): Ditto. (lrint<mode><v_f2di_convert>2): New pattern for cvt from FP to DI. (lround<mode><v_f2di_convert>2): Ditto. (lceil<mode><v_f2di_convert>2): Ditto. (lfloor<mode><v_f2di_convert>2): Ditto. * config/riscv/vector-iterators.md: Renew iterators for both the SI and DI. Signed-off-by: Pan Li <pan2.li@intel.com>
2023-11-03RISC-V: Fix redundant vsetvl in fixed-vlmax vectorized codes[PR112326]Juzhe-Zhong5-45/+124
With compile option --param=riscv-autovec-preference=fixed-vlmax, we have redundant AVL/VL toggling: vsetvli a5,a3,e8,mf4,ta,ma -> should be changed into e32m1 vle32.v v1,0(a1) vle32.v v2,0(a0) vsetivli zero,4,e32,m1,ta,ma -> redundant slli a2,a5,2 vadd.vv v1,v1,v2 sub a3,a3,a5 vsetvli zero,a5,e32,m1,ta,ma -> redundant vse32.v v1,0(a4) add a0,a0,a2 add a1,a1,a2 add a4,a4,a2 bne a3,zero,.L3 The root cause is because we simplify AVL into immediate AVL too early in FIXED-VLMAX situation. The later avlprop PASS failed to propagate AVL generated by (SELECT_VL/vsetvl VL, AVL) into the normal RVV instruction. So we need to remove immedate AVL simplification in 'expand' stage. After this patch: vsetvli a5,a3,e32,m1,ta,ma slli a2,a5,2 vle32.v v1,0(a1) vle32.v v2,0(a0) sub a3,a3,a5 vadd.vv v1,v1,v2 vse32.v v1,0(a4) add a0,a0,a2 add a1,a1,a2 add a4,a4,a2 bne a3,zero,.L3 After the removed simplification, the following situation should be fixed: typedef int8_t vnx2qi __attribute__ ((vector_size (2))); __attribute__ ((noipa)) void f_vnx2qi (int8_t a, int8_t b, int8_t *out) { vnx2qi v = {a, b}; *(vnx2qi *) out = v; } We should use vsetvili zero, 2 instead of vsetvl a5,zero. Such simplification is done in avlprop PASS which is also included in this patch to fix regression of these situation. PR target/112326 gcc/ChangeLog: * config/riscv/riscv-avlprop.cc (get_insn_vtype_mode): New function. (simplify_replace_vlmax_avl): Ditto. (pass_avlprop::execute): Add immediate AVL simplification. * config/riscv/riscv-protos.h (imm_avl_p): Rename. * config/riscv/riscv-v.cc (const_vlmax_p): Ditto. (imm_avl_p): Ditto. (emit_vlmax_insn): Adapt for new interface name. * config/riscv/vector.md (mode_idx): New attribute. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/pr112326.c: New test.
2023-11-03Revert "RISC-V: Refactor prefix [I/L/LL] rounding API autovec iterator"Pan Li2-237/+34
This reverts commit 81a81abec5c28f2c08f986f1f17ac66e555cbd4b.
2023-11-03Daily bump.GCC Administrator8-1/+231
2023-11-02RISC-V: Add check for types without insn reservationsEdwin Lu1-0/+6
Now that all insns are guaranteed to have a type, ensure every insn is associated with a cpu unit/insn reservation. gcc/ChangeLog: * config/riscv/riscv.cc (riscv_sched_variable_issue): add disabled assert Signed-off-by: Edwin Lu <ewlu@rivosinc.com>
2023-11-02Fortran: Fix for regression in ASSOCIATE [PR112316]Paul Thomas2-50/+125
2023-11-02 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/112316 * parse.cc (parse_associate): Remove condition that caused this regression. gcc/testsuite/ PR fortran/112316 * gfortran.dg/pr112316.f90: New test.
2023-11-02c++: use hash_set in nrv_dataJason Merrill1-14/+12
I noticed we were using a hash_table directly here instead of the simpler hash_set interface. Also, let's check for the variable itself and repeats earlier, since they should happen more often than any of the other cases. gcc/cp/ChangeLog: * semantics.cc (nrv_data): Change visited to hash_set. (finalize_nrv_r): Reorganize.
2023-11-02c++: retval dtor on rethrow [PR112301]Jason Merrill3-4/+142
In r12-6333 for PR33799, I fixed the example in [except.ctor]/2. In that testcase, the exception is caught and the function returns again, successfully. In this testcase, however, the exception is rethrown, and hits two separate cleanups: one in the try block and the other in the function body. So we destroy twice an object that was only constructed once. Fortunately, the fix for the normal case is easy: we just need to clear the "return value constructed by return" flag when we do it the first time. This gets more complicated with the named return value optimization, since we don't want to destroy the return value while the NRV variable is still in scope. PR c++/112301 PR c++/102191 PR c++/33799 gcc/cp/ChangeLog: * except.cc (maybe_splice_retval_cleanup): Clear current_retval_sentinel when destroying retval. * semantics.cc (nrv_data): Add in_nrv_cleanup. (finalize_nrv): Set it. (finalize_nrv_r): Fix handling of throwing cleanups. gcc/testsuite/ChangeLog: * g++.dg/eh/return1.C: Add more cases.
2023-11-02c: Add missing conditions in Walloc-size to avoid ICEs [PR112347]Martin Uecker2-0/+16
Fix ICE because of forgotten checks for pointers to void and incomplete arrays. Committed as obvious. PR c/112347 gcc/c: * c-typeck.cc (convert_for_assignment): Add missing check. gcc/testsuite: * gcc.dg/Walloc-size-3.c: New test.
2023-11-02d: Merge upstream dmd, druntime 643b1261bb, phobos 1c98326e7Iain Buclaw54-770/+1052
D front-end changes: - Suggested preview switches now give gdc flags (PR109681). - `new S[10]' is now lowered to `_d_newarrayT!S(10)'. D runtime changes: - Runtime compiler library functions `_d_newarrayU', `_d_newarrayT', `_d_newarrayiT' have been converted to templates. Phobos changes: - Add new `std.traits.Unshared' template. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 643b1261bb. * d-attribs.cc (build_attributes): Update for new front-end interface. * d-lang.cc (d_post_options): Likewise. * decl.cc (layout_class_initializer): Likewise. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime 643b1261bb. * libdruntime/Makefile.am (DRUNTIME_DSOURCES_FREEBSD): Add core/sys/freebsd/ifaddrs.d, core/sys/freebsd/net/if_dl.d, core/sys/freebsd/sys/socket.d, core/sys/freebsd/sys/types.d. (DRUNTIME_DSOURCES_LINUX): Add core/sys/linux/linux/if_arp.d, core/sys/linux/linux/if_packet.d. * libdruntime/Makefile.in: Regenerate. * src/MERGE: Merge upstream phobos 1c98326e7.
2023-11-02[committed] Improve H8 sequences for single bit sign extractionsJeff Law1-0/+91
Spurred by Roger's recent work on ARC, this patch improves the code we generation for single bit sign extractions. The basic idea is to get the bit we want into C, the use a subx;ext.w;ext.l sequence to sign extend it in a GPR. For bits 0..15 we can use a bld instruction to get the bit we want into C. For bits 16..31, we can move the high word into the low word, then use bld. There's a couple special cases where we can shift the bit we want from the high word into C which is an instruction smaller. Not surprisingly most cases seen in newlib and the test suite are extractions from the low byte, HImode sign bit and top two bits of SImode. Regression tested on the H8 with no regressions. Installing on the trunk. gcc/ * config/h8300/combiner.md: Add new patterns for single bit sign extractions.
2023-11-02analyzer: fix clang warnings [PR112317]David Malcolm3-23/+9
No functional change intended. gcc/analyzer/ChangeLog: PR analyzer/112317 * access-diagram.cc (class x_aligned_x_ruler_widget): Eliminate unused field "m_col_widths". (access_diagram_impl::add_valid_vs_invalid_ruler): Update for above change. * region-model.cc (check_one_function_attr_null_terminated_string_arg): Remove unused variables "cd_unchecked", "strlen_sval", and "limited_sval". * region-model.h (region_model_context_decorator::warn): Add missing "override". Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2023-11-02RISC-V: Refactor prefix [I/L/LL] rounding API autovec iteratorPan Li2-34/+237
The previous rounding API start with i/l/ll only works on the same mode types. For example as below, and we arrange the iterator similar to fcvt. * SF => SI * DF => DI After we refined this limination from middle-end, these API can also vectorized with different type sizes, aka: * HF => SI, HF => DI * SF => DI, SF => SI * DF => SI, DF => DI Then the iterator cannot take care of this simply and this patch would like to re-arrange the iterator in two items. * V_VLS_F_CONVERT_SI: handle (HF, SF, DF) => SI * V_VLS_F_CONVERT_DI: handle (HF, SF, DF) => DI As well as related mode_attr to reconcile the new iterator. gcc/ChangeLog: * config/riscv/autovec.md (lrint<mode><v_i_l_ll_convert>2): Remove. (lround<mode><v_i_l_ll_convert>2): Ditto. (lceil<mode><v_i_l_ll_convert>2): Ditto. (lfloor<mode><v_i_l_ll_convert>2): Ditto. (lrint<mode><v_f2si_convert>2): New pattern for cvt from FP to SI. (lround<mode><v_f2si_convert>2): Ditto. (lceil<mode><v_f2si_convert>2): Ditto. (lfloor<mode><v_f2si_convert>2): Ditto. (lrint<mode><v_f2di_convert>2): New pattern for cvt from FP to DI. (lround<mode><v_f2di_convert>2): Ditto. (lceil<mode><v_f2di_convert>2): Ditto. (lfloor<mode><v_f2di_convert>2): Ditto. * config/riscv/vector-iterators.md: Renew iterators for both the SI and DI. Signed-off-by: Pan Li <pan2.li@intel.com>
2023-11-02doc: explicitly say 'lifetime' for DCESam James1-1/+1
Say 'memory lifetime' rather than 'memory life' as lifetime is the more standard term nowadays (indeed we have e.g. -fno-lifetime-dse). It's also easier to grep for if someone is looking for the documentation on where we do that. gcc/ChangeLog: * doc/passes.texi (Dead code elimination): Explicitly say 'lifetime' as this has become the standard term for what we're doing here. Signed-off-by: Sam James <sam@gentoo.org>
2023-11-02RISC-V: Fix bug of AVL propagation PASSJuzhe-Zhong1-0/+7
A run FAIL suddenly shows up today to me: FAIL: gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-11.c execution test that I didn't have before. After investigation, I realize that there is a bug in AVL propagtion PASS. gcc/ChangeLog: * config/riscv/riscv-avlprop.cc (pass_avlprop::get_vlmax_ta_preferred_avl): Don't allow non-real insn AVL propation.