diff --git a/.editorconfig b/.editorconfig index e5e9997f44fa..4d53220ba8ed 100644 --- a/.editorconfig +++ b/.editorconfig @@ -53,6 +53,7 @@ charset = utf-8 charset = utf-8 indent_style = tab indent_size = 2 +tab_width = 8 trim_trailing_whitespace = true # GCC .def files. These are generally C fragments that get included @@ -61,18 +62,21 @@ trim_trailing_whitespace = true charset = utf-8 indent_style = tab indent_size = 2 +tab_width = 8 trim_trailing_whitespace = true # Texinfo files [*.texi] charset = utf-8 indent_size = 2 +tab_width = 8 trim_trailing_whitespace = true # Expect / TCL [*.{exp,tcl}] indent_style = tab indent_size = 4 +tab_width = 8 trim_trailing_whitespace = true # Python @@ -91,24 +95,28 @@ trim_trailing_whitespace = true [gcc/config/**.md] indent_style = tab indent_size = 2 +tab_width = 8 trim_trailing_whitespace = true # Awk [*.awk] indent_style = tab indent_size = 2 +tab_width = 8 trim_trailing_whitespace = true # Autoconf [*.{ac,m4}] indent_style = tab indent_size = 2 +tab_width = 8 trim_trailing_whitespace = true # Shell scripts [*.sh] indent_style = tab indent_size = 4 +tab_width = 8 trim_trailing_whitespace = true # Ada diff --git a/ChangeLog b/ChangeLog index 5b28068bacad..835b7c257211 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2025-10-30 Robin Dapp + + * MAINTAINERS: Add myself to reviewers/maintainers. + +2025-10-28 Richard Earnshaw + + * .editorconfig: Explicitly set tab_width whenever a + config rule has indent_style = tab and indent_size != 8. + +2025-10-28 Artemiy Volkov + + * MAINTAINERS: Add myself to write after approval. + +2025-10-27 Jennifer Schmitz + + * MAINTAINERS: Change email address. + 2025-10-24 Thomas Schwinge PR driver/81358 diff --git a/MAINTAINERS b/MAINTAINERS index 984e906fc61c..db64fa511ecd 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -109,6 +109,7 @@ powerpcspe port Andrew Jenner pru port Dimitar Dimitrov riscv port Kito Cheng riscv port Palmer Dabbelt +riscv port Robin Dapp riscv port Andrew Waterman riscv port Jim Wilson rs6000/powerpc port David Edelsohn @@ -317,11 +318,11 @@ Plugin Le-Chun Wu register allocation Peter Bergner register allocation Kenneth Zadeck register allocation Seongbae Park -riscv port Robin Dapp riscv port Juzhe Zhong RTL optimizers Steven Bosscher selective scheduling Andrey Belevantsev selective scheduling Alexander Monakov +vectorizer (+ tree-if-conv) Robin Dapp wide-int Kenneth Zadeck wide-int Mike Stump wide-int Richard Sandiford @@ -868,6 +869,7 @@ Ilya Verbin iverbin Andre Vieira avieira Rasmus Villemoes - Kugan Vivekanandarajah kugan +Artemiy Volkov artemiyv Marcel Vollweiler - Ville Voutilainen ville Tom de Vries vries diff --git a/contrib/ChangeLog b/contrib/ChangeLog index 8a1d884d7c35..118e17726d86 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,8 @@ +2025-10-30 Owen Avery + + * gcc-changelog/git_commit.py (ignored_prefixes): Add + 'libgrust/rustc-lib/core/'. + 2025-10-16 David Malcolm * gcc.doxy (INPUT): Add gcc/custom-sarif-properties diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 65ccd4bf58bd..53c6bd0e1113 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,432 @@ +2025-10-30 David Faust + + PR debug/122248 + * dwarf2out.cc (gen_btf_tag_dies): Always replace an existing + AT_GNU_annotation on the target die. + +2025-10-30 David Faust + + * btfout.cc (btf_add_used_type_1): Do not consider creating + fixups at typedefs. + +2025-10-30 Michal Jires + + * lto-cgraph.cc (output_symtab): Remove asm_nodes_out. + * lto-streamer-out.cc (lto_output_toplevel_asms): Use + partitioning. + (create_order_remap): Remove asm_nodes_out. + (lto_output): In LGEN add asm_nodes into partition. + * lto-streamer.h (lto_output_toplevel_asms): Add encoder. + +2025-10-30 Michal Jires + + * lto-cgraph.cc (compute_ltrans_boundary): Add asm_node. + +2025-10-30 Michal Jires + + * ipa-icf.cc (sem_item_optimizer::write_summary): Use + toplevel_node. + (sem_item_optimizer::read_section): Likewise. + * ipa-modref.cc (modref_write): Likewise. + * ipa-prop.cc (ipa_write_return_summaries): Likewise. + (ipcp_write_transformation_summaries): Likewise. + * ipa-reference.cc (ipa_reference_write_optimization_summary): + Likewise. + * lto-cgraph.cc (lto_symtab_encoder_new): Likewise. + (lto_symtab_encoder_encode): Likewise. + (lto_symtab_encoder_delete_node): Likewise. + (lto_symtab_encoder_in_partition_p): Likewise. + (lto_set_symtab_encoder_in_partition): Likewise. + (output_refs): Likewise. + (compute_ltrans_boundary): Likewise. + (output_symtab): Likewise. + (output_cgraph_opt_summary): Likewise. + * lto-streamer-out.cc (lto_output): Likewise. + (produce_symtab): Likewise. + (produce_symtab_extension): Likewise. + * lto-streamer.h (struct lto_encoder_entry): Likewise. + (struct lto_symtab_encoder_d): Likewise. + (lto_symtab_encoder_encode): Likewise. + (lto_symtab_encoder_delete_node): Likewise. + (lto_symtab_encoder_in_partition_p): Likewise. + (lto_symtab_encoder_lookup): Likewise. + (lsei_next): Likewise. + (lsei_varpool_node): Likewise. + +2025-10-30 Michal Jires + + * cgraph.h (enum symtab_type): Replace with toplevel_type. + (enum toplevel_type): New. + (struct toplevel_node): New. + (struct asm_node): Inherits from toplevel_node. + (test): New. + (symbol_table::finalize_toplevel_asm): Use constructor. + * coretypes.h (struct toplevel_node): New. + (struct asm_node): New. + * lto-streamer-in.cc (lto_input_toplevel_asms): Add + lto_file_data. + +2025-10-30 Michal Jires + + * cgraph.cc (cgraph_node::release_body): Keep lto_file_data. + (cgraph_node::remove): likewise. + * lto-section-in.cc (lto_free_function_in_decl_state_for_node): + likewise. + * varpool.cc (varpool_node::remove): likewise. + +2025-10-30 Qing Zhao + + * doc/extend.texi: Clarification when the counted_by attribute is applied + on a void pointer. + +2025-10-30 Andrew Pinski + + PR target/116075 + * fold-const-call.cc (fold_const_vec_shl_insert): New function. + (fold_const_call): Call fold_const_vec_shl_insert for CFN_VEC_SHL_INSERT. + * match.pd (`VEC_SHL_INSERT (dup (A), A)`): New pattern. + +2025-10-30 Andrew Pinski + + PR tree-optimization/122247 + * tree-ssa-forwprop.cc (do_simple_agr_dse): Allow phi node for the usage + if the usage of the phi result is just the "same" as the original clobber. + +2025-10-30 Andrew Pinski + + PR tree-optimization/122247 + * tree-ssa-forwprop.cc (do_simple_agr_dse): Allow + use to be a clobber of the same kind to the same lhs. + +2025-10-30 Robin Dapp + + * tree-ssa-loop-niter.cc (shifted_range_nonzero_p): New + function. + (number_of_iterations_cltz): Call new function. + * tree-ssa-loop.cc (pass_scev_cprop::execute): Enable ranger. + +2025-10-30 Robin Dapp + + PR target/122445 + * config/riscv/riscv-avlprop.cc (pass_avlprop::get_vlmax_ta_preferred_avl): + Scale AVL of subreg uses. + +2025-10-30 Artemiy Volkov + + PR tree-optimization/122478 + * match.pd: Fix the view_convert (BIT_FIELD_REF) pattern. + +2025-10-30 Richard Biener + + * config/i386/i386-options.cc (ix86_option_override_internal): + Fix check during opts->x_ix86_move_max initialization. + +2025-10-30 Stefan Schulze Frielinghaus + + PR rtl-optimization/121198 + * lra-constraints.cc (process_alt_operands): Compute least upper + bound of all register classes over all required registers in + order to determine register class for a hard register constraint. + +2025-10-30 Richard Biener + Eric Botcazou + + * tree-vect-slp.cc (vect_get_operand_map): Handle commutative + operands when swapping is requested. + (vect_build_slp_tree_1): Allow STMT_VINFO_REDUC_IDX differences + when operand swapping makes them match and request swapping. + (vect_build_slp_instance): Indicate we have successfully + discovered a SLP reduction group. + +2025-10-30 Uros Bizjak + + PR target/116815 + * config/i386/i386.md (ovf_add_cmp): New code attribute. + (udf_sub_cmp): Ditto. + (ovf_comm): New int iterator. + (*plus_within_3_): New insn and split pattern. + (*minus_within_3): Ditto. + +2025-10-30 Andrew Pinski + + * gimple-fold.cc (gimple_fold_builtin_assume_aligned): Remove. + (gimple_fold_builtin): Don't fold __builtin_assume_aligned + +2025-10-30 Andrew Pinski + + Revert: + 2025-10-27 Andrew Pinski + + PR middle-end/107389 + PR tree-optimization/122086 + * tree-ssa-forwprop.cc (forwprop_may_propagate_copy): New function. + (pass_forwprop::execute): Use forwprop_may_propagate_copy + instead of may_propagate_copy. + +2025-10-30 Richard Biener + + PR tree-optimization/120687 + * tree-vect-slp.cc (vect_optimize_slp_pass::is_compatible_layout): + New overload for checking a whole partition. + (vect_optimize_slp_pass::legitimize): New function trying + a single layout for all partitions for now. + (vect_optimize_slp_pass::run): Try legitimizing to a single + layout before propagating. + (vect_slp_analyze_operations): For dumping deal with + SLP_TREE_SCALAR_STMTS being empty or element zero being NULL. + +2025-10-30 liuhongt + + PR target/122457 + * config/i386/sse.md (VI2_AVX10_2): New mode iterator. + (usdot_prod): Use VI2_AVX10_2 + instead of VI2_AVX512F. + (udot_prod): Ditto. + +2025-10-30 Guo Jie + + * config/loongarch/lasx.md (fnma4): Remove. + * config/loongarch/lsx.md (fnma4): Remove. + * config/loongarch/simd.md (fnma4): Simplify and correct. + +2025-10-30 Jinyang He + Peng Fan + + * config/loongarch/loongarch.cc + (loongarch_expand_conditional_move): Only allow valid binary + op when optimize conditional move. + +2025-10-29 Jeff Law + + Revert: + 2025-10-29 Jeff Law + + PR target/116662 + * config/riscv/riscv.cc (riscv_option_override): Override + default value for destructive interference size. + +2025-10-29 Jeff Law + + Revert: + 2025-10-29 Jeff Law + + PR target/116662 + * config/riscv/riscv.cc (riscv_option_override): Apply correct version + of the patch. + +2025-10-29 Jeff Law + + PR target/116662 + * config/riscv/riscv.cc (riscv_option_override): Apply correct version + of the patch. + +2025-10-29 Jeff Law + + PR target/116662 + * config/riscv/riscv.cc (riscv_option_override): Override + default value for destructive interference size. + +2025-10-29 Andrew MacLeod + + PR tree-optimization/91191 + * gimple-range-op.cc (gimple_range_op_handler): Descend one + operand lower for a VIEW_CONVERT_EXPR. + * range-op-mixed.h (class operator_view): New. + * range-op.cc (range_op_table): Add VIEW_CONVERT_EXPR case. + (operator_view::fold_range): New. + (operator_view::op1_range): New. + (operator_view::update_bitmask): New. + +2025-10-29 Richard Biener + + * tree-vect-slp.cc (vect_analyze_slp): Mark stmts in BB roots + as released after vect_build_slp_instance. + (vect_build_slp_instance): Release scalar_stmts when exiting + early. + +2025-10-29 Lulu Cheng + + PR target/122097 + * config/loongarch/loongarch.cc + (loongarch_const_vector_bitimm_set_p): Add support for vector float. + (loongarch_const_vector_bitimm_clr_p): Likewise. + (loongarch_print_operand): Likewise. + * config/loongarch/simd.md (and3): Likewise. + +2025-10-29 Lulu Cheng + + * config/loongarch/lasx.md (xor3): Delete. + (ior3): Delete. + (and3): Delete. + * config/loongarch/lsx.md (xor3): Delete. + (ior3): Delete. + (and3): Delete. + * config/loongarch/simd.md (xor3): Define. + (ior3): Likewise. + (and3): Likewise. + +2025-10-29 Xi Ruoyao + + * config/loongarch/genopts/loongarch.opt.in (-mbreak-code=): + New. + * config/loongarch/loongarch.opt: Regenerate. + * config/loongarch/loongarch.md (trap): Separate to a + define_insn and a define_expand which takes la_break_code. + * doc/invoke.texi (-mbreak-code=): Document. + * config/loongarch/loongarch.opt.urls: Regenerate. + +2025-10-28 Richard Biener + + * tree-vect-loop-manip.cc (vect_update_ivs_after_vectorizer): + Avoid explicit LOOP_VINFO_IV_EXIT reference. + +2025-10-28 Artemiy Volkov + + * match.pd: Add pattern to simplify view_convert (BIT_FIELD_REF). + +2025-10-28 Kito Cheng + + * config/riscv/riscv.cc (riscv_get_vls_cc_attr): Fix error message + parameter order and add check_only condition. Improve diagnostic + message formatting with proper quoting. + (riscv_handle_rvv_vls_cc_attribute): Anonymize unused node parameter. + +2025-10-28 Avinash Jayakar + + PR tree-optimization/122065 + * tree-vect-generic.cc (add_rshift): Update name and add code parameter. + (add_shift): Update name. + (expand_vector_mult): New lowering for MULT_EXPR. + (expand_vector_divmod): Use updated function name. + (expand_vector_operation): Use updated function name. + +2025-10-27 Andrew Pinski + + * expr.cc (expr_has_boolean_range): New function. + (expand_expr_real_2): Use expr_has_boolean_range instead of + gimple_zero_one_valued_p. + * tree-ssanames.cc (ssa_name_has_boolean_range): Update to take + a gimple STMT. + * tree-ssanames.h (ssa_name_has_boolean_range): Update for the new + argument and default to nullptr. + +2025-10-27 Andrew Pinski + + PR tree-optimization/105749 + PR tree-optimization/80635 + * match.pd (`VCE(zero_one_valued_p) ==\!= 0`): New pattern. + +2025-10-27 Tamar Christina + + PR tree-optimization/122408 + * tree-vect-slp-patterns.cc (vect_validate_multiplication): Cleanup and + document interface. + (complex_mul_pattern::matches, complex_fms_pattern::matches): Update to + new interface. + +2025-10-27 Andrew Stubbs + + PR tree-optimization/104116 + * config/gcn/gcn-valu.md (abs2): New define_expand for + integer vector modes. + +2025-10-27 Richard Biener + + PR middle-end/122325 + * common.opt (flag_default_complex_method): Remove. + * opts.cc (init_options_struct): Default to fortran rules + for complex evaluations. + (finish_options): Remove (re-)instantiating of the frontend + default of the complex evaluation method. + +2025-10-27 Kito Cheng + + * config/riscv/riscv-protos.h (riscv_init_cumulative_args): Add + bool parameter. + * config/riscv/riscv.h (enum riscv_cc): Add RISCV_CC_VLS_V_32, + RISCV_CC_VLS_V_64, RISCV_CC_VLS_V_128, RISCV_CC_VLS_V_256, + RISCV_CC_VLS_V_512, RISCV_CC_VLS_V_1024, RISCV_CC_VLS_V_2048, + RISCV_CC_VLS_V_4096, RISCV_CC_VLS_V_8192, RISCV_CC_VLS_V_16384. + (CUMULATIVE_ARGS): Add abi_vlen field. + * config/riscv/riscv.cc (riscv_handle_rvv_vls_cc_attribute): New + function. + (riscv_gnu_attributes): Add vls_cc attribute entry. + (riscv_attributes): Add riscv_vls_cc attribute entry. + (riscv_flatten_aggregate_field): Add vls_p and abi_vlen parameters + to handle VLS vector types. + (riscv_flatten_aggregate_argument): Update call to + riscv_flatten_aggregate_field. + (riscv_get_vector_arg): Add vls_p parameter for VLS handling. + (riscv_vls_cc_p): New function. + (riscv_get_cc_abi_vlen): New function. + (riscv_valid_abi_vlen_vls_cc_p): New function. + (riscv_get_riscv_cc_by_abi_vlen): New function. + (riscv_get_vls_container_type): New function. + (riscv_pass_vls_in_vr): New function. + (riscv_pass_aggregate_in_vr): New function. + (riscv_get_arg_info): Add VLS calling convention handling. + (riscv_function_arg_advance): Update for VLS calling convention. + (riscv_return_in_memory): Add fntype parameter and initialize + cumulative args properly. + (riscv_v_abi): Add abi parameter. + (riscv_get_vls_cc_attr): New function. + (riscv_vls_cc_function_abi): New function. + (riscv_fntype_abi): Add VLS calling convention detection. + (riscv_asm_output_variant_cc): Update for VLS calling convention. + +2025-10-27 Jeff Law + + PR target/64345 + PR tree-optimization/80770 + * config/riscv/bitmanip.md (_not_const): Turn into a + peephole2 to avoid matching prior to combine. + * ifcvt.cc (noce_try_sign_bit_splat): When costs are equal steer + towards an AND based sequence. + +2025-10-27 Richard Biener + + PR tree-optimization/122419 + * tree-vect-slp.cc (vect_analyze_slp_reduc_chain): Only + skip noop conversions. + +2025-10-27 Richard Biener + + PR tree-optimization/122435 + * tree-ssa-sccvn.cc (eliminate_dom_walker::eliminate_stmt): + Also match noop conversions when detecting redundant stores. + +2025-10-27 Guo Jie + + * config/loongarch/loongarch.cc (loongarch_rtx_costs): + Ignore the cost impact of SIGN_EXTEND/ZERO_EXTEND. + +2025-10-27 Guo Jie + + * config/loongarch/loongarch.md (both_non_zero): New combiner. + (both_non_zero_subreg): Ditto. + +2025-10-27 Guo Jie + + * config/loongarch/loongarch.md + (sign_extend_ashift): New combiner. + +2025-10-27 Kito Cheng + + * function-abi.h (NUM_ABI_IDS): Increase from 8 to 12. + +2025-10-27 Takayuki 'January June' Suwa + + * config/xtensa/xtensa.md (one_cmplsi2): + Rearrange back as an expand pattern. + +2025-10-27 Andrew Pinski + + PR middle-end/107389 + PR tree-optimization/122086 + * tree-ssa-forwprop.cc (forwprop_may_propagate_copy): New function. + (pass_forwprop::execute): Use forwprop_may_propagate_copy + instead of may_propagate_copy. + 2025-10-26 Andrew Pinski PR target/122270 diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 6e95effb6d93..986fa53aa44a 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20251027 +20251031 diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index e6dbda6646a5..f91fc3118cfa 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,168 @@ +2025-10-30 Eric Botcazou + + PR ada/15610 + * sem_type.adb (Collect_Interps): Apply the same visibility + criterion to expanded names as Find_Expanded_Name. + +2025-10-30 Eric Botcazou + + PR ada/54178 + * sem_ch12.adb (Instantiate_Object): Strip qualification to detect + aggregates used as actuals. + +2025-10-30 Eric Botcazou + + PR ada/16214 + * sem_ch8.adb (Find_Expanded_Name): Consolidate and streamline the + processing required for references to instances within themselves. + +2025-10-28 Eric Botcazou + + PR ada/48039 + * sem_ch12.adb (Analyze_Subprogram_Instantiation): Call + Remove_Homonym to remove the enclosing package from visibility. + +2025-10-28 Eric Botcazou + + * exp_util.adb (Remove_Side_Effects): Use separately the Etype of + the expression to build new nodes and its Underlying_Type to drive + part of the processing. + +2025-10-28 Johannes Kliemann + + * adaint.c: Remove __gnat_enable_signals, __gnat_disable_signals + and related code for QNX. + * libgnarl/s-taprop__qnx.adb: Disable and enable + signals in Ada. + +2025-10-28 Alexandre Oliva + + * sem_ch13.adb (Analyze_Aspect_Export_Import): Skip + Set_Is_Imported on E_Exception. + * sem_prag.adb (Process_Import_Or_Interface): Explain + why not Set_Is_Imported. + +2025-10-28 Denis Mazzucato + + * sem_util.adb (Collect_Primitive_Operations): Avoid setting + Is_Primitive for noninherited and nonoverriding subprograms not + declared immediately within a package specification. + * sem_ch13.adb (Check_Nonoverridable_Aspect_Subprograms): Better + error posting to allow multiple errors on same type but different + aggregate subprogram. + +2025-10-28 Ronan Desplanques + + * table.ads (Clear, Is_Empty): New subprograms. + * table.adb (Clear, Is_Empty): Likewise. + (Init): Use new subprogram. + * atree.adb (Traverse_Func_With_Parent): Use new subprograms. + * fmap.adb (Empty_Tables): Use new subprogram. + * par_sco.adb (Process_Pending_Decisions): Likewise. + * sem_elab.adb (Check_Elab_Call): Likewise. + * sem_ch12.adb (Build_Local_Package, Analyze_Package_Instantiation, + Analyze_Subprogram_Instantiation): Likewise. + (Save_And_Reset): Use Table.Table.First. + +2025-10-28 Eric Botcazou + + PR ada/122063 + * exp_fixd.adb (Build_Double_Divide_Code): Convert the result of the + multiply. + (Build_Multiply): Use base types of operands to size the operation. + (Build_Rem): Likewise. + (Build_Scaled_Divide_Code): Convert the result of the multiply. + +2025-10-28 Tonu Naks + + * doc/gnat_rm/obsolescent_features.rst: typo + * gnat_rm.texi: Regenerate. + +2025-10-28 Javier Miranda + + * aspects.adb (Get_Aspect_Id): Enable aspect Unsigned_Base_Range + using -gnatd.u + * debug.adb (Debug_Flag_Dot_U): Document this switch. + * einfo-utils.adb (Is_Modular_Integer_Type): Return True if + the entity is a modular integer type and its base type does + not have the attribute has_unsigned_base_range_aspect. + (Is_Signed_Integer_Type): Return True if the entity is a signed + integer type, or it is a modular integer type and its base type + has the attribute has_unsigned_base_range_aspect. + * einfo.ads (E_Modular_Integer_Type): Add documentation of + Has_Unsigned_Base_Range_Aspect. + * par-ch4.adb (Scan_Apostrophe): Enable attribute Unsigned_Base_Range + using -gnatd.u + * sem_ch13.adb (Analyze_One_Aspect): Check general language + restrictions on aspect Unsigned_Base_Range. For Unsigned_Base_Range + aspect, do not delay the generation of the pragma becase we need + to process it before any type or subtype derivation is analyzed. + * sem_ch3.adb (Build_Scalar_Bound): Disable code analyzing the + bound with the base type of the parent type because, for unsigned + base range types, their base type is a modular type but their + type is a signed integer type. + * sem_prag.adb (Analyze_Pragma): Enable pragma Unsigned_Base_Range + using -gnatd.u. Check more errors on Unsigned_Base_Range pragma, + and create the new base type only when required. + +2025-10-28 Ronan Desplanques + + * sem_ch12.adb (Build_Local_Package) + (Analyze_Package_Instantiation, Analyze_Subprogram_Instantiation): + Fix Set_Last calls. + (Set_Instance_Of): Use Table.Table.Append. + (Save_And_Reset): Remove useless call. Remove defensive code. + (Restore): Remove incorrect Set_Last call and adapt to + Set_Instance_Of change. + +2025-10-28 Denis Mazzucato + + * sem_prag.adb (Analyze_Pragma): Add enclosing quotation when the + invalid switch ends with a space. + +2025-10-28 Eric Botcazou + + PR ada/59234 + * sem_ch12.adb (Analyze_Formal_Package_Declaration): Mark the + special name built for the formal in the parent of a child unit + as internal. + +2025-10-28 Eric Botcazou + + PR ada/34511 + * sem_ch12.adb (Analyze_Associations): Add Parent_Installed formal + parameter and pass it in call to Analyze_One_Association. + (Analyze_One_Association): Add Parent_Installed formal parameter + and pass it in call to Instantiate_Formal_Subprogram. + (Analyze_Formal_Package_Declaration): Pass Parent_Installed in call + to Analyze_Associations. + (Analyze_Package_Instantiation): Likewise. + (Analyze_Subprogram_Instantiation): Likewise. + (Instantiate_Formal_Subprogram): Add Parent_Installed formal + parameter and prune references to the parent unit(s) only if + it is true. + +2025-10-27 Eric Botcazou + + PR ada/29958 + * sem_ch7.adb (Declare_Inherited_Private_Subprograms): Deal with + formal types specially. + +2025-10-27 Eric Botcazou + + PR ada/25988 + * sem_ch12.adb (Save_Global_References.Reset_Entity): Also call + Save_Global_Defaults for instances with an expanded name. + (Save_Global_References.Save_References): Minor code cleanup. + +2025-10-27 Eric Botcazou + + PR ada/15800 + * freeze.adb (Freeze_Entity.Freeze_Record_Type): Small cleanup + in code and comments. + * gcc-interface/utils.cc (create_field_decl): Assert that the type + of the field is frozen at this point. + 2025-10-26 Eric Botcazou PR ada/13370 diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c index 7b78d91e0e72..adc39517280a 100644 --- a/gcc/ada/adaint.c +++ b/gcc/ada/adaint.c @@ -107,7 +107,6 @@ #ifdef __QNX__ #include #include -#include #endif #ifdef IN_RTS @@ -3720,68 +3719,6 @@ void __gnat_killprocesstree (int pid, int sig_num) */ } -#if defined (__QNX__) - -static __thread sigset_t set; -static __thread sigset_t oset; -static __thread int signals_disabled = 0; - -int __gnat_disable_signals(void) -{ - sigemptyset(&set); - sigaddset(&set, SIGHUP); - sigaddset(&set, SIGINT); - sigaddset(&set, SIGQUIT); - sigaddset(&set, SIGILL); - sigaddset(&set, SIGTRAP); - sigaddset(&set, SIGIOT); - sigaddset(&set, SIGABRT); - sigaddset(&set, SIGEMT); - sigaddset(&set, SIGDEADLK); - sigaddset(&set, SIGFPE); - sigaddset(&set, SIGKILL); - sigaddset(&set, SIGBUS); - sigaddset(&set, SIGSEGV); - sigaddset(&set, SIGSYS); - sigaddset(&set, SIGPIPE); - sigaddset(&set, SIGALRM); - sigaddset(&set, SIGTERM); - sigaddset(&set, SIGUSR1); - sigaddset(&set, SIGUSR2); - sigaddset(&set, SIGCHLD); - sigaddset(&set, SIGCLD); - sigaddset(&set, SIGPWR); - sigaddset(&set, SIGWINCH); - sigaddset(&set, SIGURG); - sigaddset(&set, SIGPOLL); - sigaddset(&set, SIGIO); - sigaddset(&set, SIGSTOP); - sigaddset(&set, SIGTSTP); - sigaddset(&set, SIGCONT); - sigaddset(&set, SIGTTIN); - sigaddset(&set, SIGTTOU); - sigaddset(&set, SIGVTALRM); - sigaddset(&set, SIGPROF); - sigaddset(&set, SIGXCPU); - sigaddset(&set, SIGXFSZ); - sigaddset(&set, SIGDOOM); - - int ret = sigprocmask(SIG_BLOCK, &set, &oset); - signals_disabled = !ret; - return ret; -} - -int __gnat_enable_signals(void) -{ - if (!signals_disabled) { - return 0; - } - signals_disabled = 0; - return sigprocmask(SIG_SETMASK, &oset, 0); -} - -#endif - #ifdef __cplusplus } #endif diff --git a/gcc/ada/aspects.adb b/gcc/ada/aspects.adb index c9eaea1b7f94..aecbbe270730 100644 --- a/gcc/ada/aspects.adb +++ b/gcc/ada/aspects.adb @@ -24,6 +24,7 @@ ------------------------------------------------------------------------------ with Atree; use Atree; +with Debug; use Debug; with Einfo; use Einfo; with Einfo.Entities; use Einfo.Entities; with Einfo.Utils; use Einfo.Utils; @@ -282,7 +283,9 @@ package body Aspects is begin -- Aspect Unsigned_Base_Range temporarily disabled - if Name = Name_Unsigned_Base_Range then + if Name = Name_Unsigned_Base_Range + and then not Debug_Flag_Dot_U + then return No_Aspect; end if; diff --git a/gcc/ada/atree.adb b/gcc/ada/atree.adb index 14d9ba4bb2fd..327bc2d70936 100644 --- a/gcc/ada/atree.adb +++ b/gcc/ada/atree.adb @@ -2766,14 +2766,14 @@ package body Atree is -- it is global and hence a tree traversal with parents must be finished -- before the next tree traversal with parents starts. - pragma Assert (Parents_Stack.Last = 0); - Parents_Stack.Set_Last (0); + pragma Assert (Parents_Stack.Is_Empty); + Parents_Stack.Clear; Parents_Stack.Append (Parent (Node)); Result := Traverse (Node); Parents_Stack.Decrement_Last; - pragma Assert (Parents_Stack.Last = 0); + pragma Assert (Parents_Stack.Is_Empty); return Result; end Traverse_Func_With_Parent; diff --git a/gcc/ada/debug.adb b/gcc/ada/debug.adb index b7c54a000662..ffe4adc790e1 100644 --- a/gcc/ada/debug.adb +++ b/gcc/ada/debug.adb @@ -105,7 +105,7 @@ package body Debug is -- d.r Disable reordering of components in record types -- d.s Strict secondary stack management -- d.t Disable static allocation of library level dispatch tables - -- d.u + -- d.u Enable Unsigned_Base_Range aspect language extension -- d.v Enforce SPARK elaboration rules in SPARK code -- d.w Do not check for infinite loops -- d.x No exception handlers @@ -800,7 +800,8 @@ package body Debug is -- previous dynamic construction of tables. It is there as a possible -- work around if we run into trouble with the new implementation. - -- d.u + -- d.u Enable the support for Unsigned_Base_Range aspect, attribute, and + -- pragma. -- d.v This flag enforces the elaboration rules defined in the SPARK -- Reference Manual, chapter 7.7, to all SPARK code within a unit. As diff --git a/gcc/ada/doc/gnat_rm/obsolescent_features.rst b/gcc/ada/doc/gnat_rm/obsolescent_features.rst index d78d986f4051..f1e2061ff5ba 100644 --- a/gcc/ada/doc/gnat_rm/obsolescent_features.rst +++ b/gcc/ada/doc/gnat_rm/obsolescent_features.rst @@ -14,7 +14,7 @@ historical compatibility purposes. PolyORB ======== -AWS is a deprecated product. It will be baselined with the GNAT Pro +PolyORB is a deprecated product. It will be baselined with the GNAT Pro release 28. After this release, there will be no new versions of this product. Contact your sales representative or send a message to sales@adacore.com to get recommendations for replacements. diff --git a/gcc/ada/einfo-utils.adb b/gcc/ada/einfo-utils.adb index 290ae331d37a..b0acb25b40bc 100644 --- a/gcc/ada/einfo-utils.adb +++ b/gcc/ada/einfo-utils.adb @@ -333,7 +333,8 @@ package body Einfo.Utils is function Is_Modular_Integer_Type (Id : E) return B is begin - return Ekind (Id) in Modular_Integer_Kind; + return Ekind (Id) in Modular_Integer_Kind + and then not Has_Unsigned_Base_Range_Aspect (Base_Type (Id)); end Is_Modular_Integer_Type; function Is_Named_Access_Type (Id : E) return B is @@ -393,7 +394,10 @@ package body Einfo.Utils is function Is_Signed_Integer_Type (Id : E) return B is begin - return Ekind (Id) in Signed_Integer_Kind; + return Ekind (Id) in Signed_Integer_Kind + or else + (Ekind (Id) in Modular_Integer_Kind + and then Has_Unsigned_Base_Range_Aspect (Base_Type (Id))); end Is_Signed_Integer_Type; function Is_Subprogram (Id : E) return B is diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads index b5d9c1cde666..b9548a78f845 100644 --- a/gcc/ada/einfo.ads +++ b/gcc/ada/einfo.ads @@ -5757,6 +5757,7 @@ package Einfo is -- Non_Binary_Modulus (base type only) -- Has_Biased_Representation -- Has_Shift_Operator (base type only) + -- Has_Unsigned_Base_Range_Aspect (base type only) -- No_Predicate_On_Actual -- No_Dynamic_Predicate_On_Actual -- Type_Low_Bound (synth) diff --git a/gcc/ada/exp_fixd.adb b/gcc/ada/exp_fixd.adb index 8759099c193e..1107af3e003f 100644 --- a/gcc/ada/exp_fixd.adb +++ b/gcc/ada/exp_fixd.adb @@ -595,7 +595,8 @@ package body Exp_Fixd is Defining_Identifier => Dnn, Object_Definition => New_Occurrence_Of (QR_Typ, Loc), Constant_Present => True, - Expression => Build_Multiply (N, Y, Z))); + Expression => + Build_Conversion (N, QR_Typ, Build_Multiply (N, Y, Z)))); Quo := Build_Divide (N, @@ -656,8 +657,8 @@ package body Exp_Fixd is function Build_Multiply (N : Node_Id; L, R : Node_Id) return Node_Id is Loc : constant Source_Ptr := Sloc (N); - Left_Type : constant Entity_Id := Etype (L); - Right_Type : constant Entity_Id := Etype (R); + Left_Type : constant Entity_Id := Base_Type (Etype (L)); + Right_Type : constant Entity_Id := Base_Type (Etype (R)); Left_Size : Int; Right_Size : Int; Result_Type : Entity_Id; @@ -746,8 +747,8 @@ package body Exp_Fixd is function Build_Rem (N : Node_Id; L, R : Node_Id) return Node_Id is Loc : constant Source_Ptr := Sloc (N); - Left_Type : constant Entity_Id := Etype (L); - Right_Type : constant Entity_Id := Etype (R); + Left_Type : constant Entity_Id := Base_Type (Etype (L)); + Right_Type : constant Entity_Id := Base_Type (Etype (R)); Result_Type : Entity_Id; Rnode : Node_Id; @@ -959,7 +960,8 @@ package body Exp_Fixd is Defining_Identifier => Nnn, Object_Definition => New_Occurrence_Of (QR_Typ, Loc), Constant_Present => True, - Expression => Build_Multiply (N, X, Y)), + Expression => + Build_Conversion (N, QR_Typ, Build_Multiply (N, X, Y))), Make_Object_Declaration (Loc, Defining_Identifier => Dnn, diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 30b2461c4af6..4d88626e0d24 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -12613,8 +12613,12 @@ package body Exp_Util is -- Local variables Loc : constant Source_Ptr := Sloc (Exp); - Exp_Type : constant Entity_Id := Etype (Exp); Svg_Suppress : constant Suppress_Record := Scope_Suppress; + Typ : constant Entity_Id := Etype (Exp); + Und_Typ : constant Entity_Id := + (if Present (Typ) then Underlying_Type (Typ) else Typ); + -- The underlying type that drives part of the processing + Def_Id : Entity_Id; E : Node_Id; New_Exp : Node_Id; @@ -12640,8 +12644,9 @@ package body Exp_Util is -- (this happens because routines Duplicate_Subexpr_XX implicitly invoke -- Remove_Side_Effects). - elsif No (Exp_Type) - or else Ekind (Exp_Type) = E_Access_Attribute_Type + elsif No (Typ) + or else No (Und_Typ) + or else Ekind (Und_Typ) = E_Access_Attribute_Type then return; @@ -12690,12 +12695,12 @@ package body Exp_Util is -- anyway, see below). Also do it if we have a volatile reference and -- Name_Req is not set (see comments for Side_Effect_Free). - elsif (Is_Elementary_Type (Exp_Type) - or else (Is_Record_Type (Exp_Type) - and then Known_Static_RM_Size (Exp_Type) - and then RM_Size (Exp_Type) <= System_Max_Integer_Size - and then not Has_Discriminants (Exp_Type) - and then not Is_By_Reference_Type (Exp_Type))) + elsif (Is_Elementary_Type (Und_Typ) + or else (Is_Record_Type (Und_Typ) + and then Known_Static_RM_Size (Und_Typ) + and then RM_Size (Und_Typ) <= System_Max_Integer_Size + and then not Has_Discriminants (Und_Typ) + and then not Is_By_Reference_Type (Und_Typ))) and then (Variable_Ref or else (not Is_Name_Reference (Exp) and then Nkind (Exp) /= N_Type_Conversion) @@ -12703,7 +12708,7 @@ package body Exp_Util is and then Is_Volatile_Reference (Exp))) then Def_Id := Build_Temporary (Loc, 'R', Exp); - Set_Etype (Def_Id, Exp_Type); + Set_Etype (Def_Id, Typ); Res := New_Occurrence_Of (Def_Id, Loc); -- If the expression is a packed reference, it must be reanalyzed and @@ -12719,7 +12724,7 @@ package body Exp_Util is end if; -- Generate: - -- Rnn : Exp_Type renames Expr; + -- Rnn : Typ renames Expr; -- In GNATprove mode, we prefer to use renamings for intermediate -- variables to definition of constants, due to the implicit move @@ -12730,22 +12735,22 @@ package body Exp_Util is if Renaming_Req or else (GNATprove_Mode and then Is_Object_Reference (Exp) - and then not Is_Scalar_Type (Exp_Type)) + and then not Is_Scalar_Type (Und_Typ)) then E := Make_Object_Renaming_Declaration (Loc, Defining_Identifier => Def_Id, - Subtype_Mark => New_Occurrence_Of (Exp_Type, Loc), + Subtype_Mark => New_Occurrence_Of (Typ, Loc), Name => Relocate_Node (Exp)); -- Generate: - -- Rnn : constant Exp_Type := Expr; + -- Rnn : constant Typ := Expr; else E := Make_Object_Declaration (Loc, Defining_Identifier => Def_Id, - Object_Definition => New_Occurrence_Of (Exp_Type, Loc), + Object_Definition => New_Occurrence_Of (Typ, Loc), Constant_Present => True, Expression => Relocate_Node (Exp)); @@ -12801,7 +12806,7 @@ package body Exp_Util is elsif Nkind (Exp) = N_Unchecked_Type_Conversion and then not Safe_Unchecked_Type_Conversion (Exp) then - if CW_Or_Needs_Finalization (Exp_Type) then + if CW_Or_Needs_Finalization (Und_Typ) then -- Use a renaming to capture the expression, rather than create -- a controlled temporary. @@ -12812,18 +12817,18 @@ package body Exp_Util is Insert_Action (Exp, Make_Object_Renaming_Declaration (Loc, Defining_Identifier => Def_Id, - Subtype_Mark => New_Occurrence_Of (Exp_Type, Loc), + Subtype_Mark => New_Occurrence_Of (Typ, Loc), Name => Relocate_Node (Exp))); else Def_Id := Build_Temporary (Loc, 'R', Exp); - Set_Etype (Def_Id, Exp_Type); + Set_Etype (Def_Id, Typ); Res := New_Occurrence_Of (Def_Id, Loc); E := Make_Object_Declaration (Loc, Defining_Identifier => Def_Id, - Object_Definition => New_Occurrence_Of (Exp_Type, Loc), + Object_Definition => New_Occurrence_Of (Typ, Loc), Constant_Present => not Is_Variable (Exp), Expression => Relocate_Node (Exp)); @@ -12853,7 +12858,7 @@ package body Exp_Util is -- type and we do not have Name_Req set true (see comments for -- Side_Effect_Free). - and then (Name_Req or else not Treat_As_Volatile (Exp_Type))) + and then (Name_Req or else not Treat_As_Volatile (Und_Typ))) then Def_Id := Build_Temporary (Loc, 'R', Exp); Res := New_Occurrence_Of (Def_Id, Loc); @@ -12861,7 +12866,7 @@ package body Exp_Util is Insert_Action (Exp, Make_Object_Renaming_Declaration (Loc, Defining_Identifier => Def_Id, - Subtype_Mark => New_Occurrence_Of (Exp_Type, Loc), + Subtype_Mark => New_Occurrence_Of (Typ, Loc), Name => Relocate_Node (Exp))); -- Avoid generating a variable-sized temporary, by generating the @@ -12871,7 +12876,7 @@ package body Exp_Util is elsif Nkind (Exp) = N_Selected_Component and then Nkind (Prefix (Exp)) = N_Function_Call - and then Is_Array_Type (Exp_Type) + and then Is_Array_Type (Und_Typ) then Remove_Side_Effects (Prefix (Exp), Name_Req, Variable_Ref); goto Leave; @@ -12890,9 +12895,9 @@ package body Exp_Util is -- to the object in the latter case. if Nkind (Exp) = N_Function_Call - and then (Is_Build_In_Place_Result_Type (Exp_Type) + and then (Is_Build_In_Place_Result_Type (Und_Typ) or else - Is_Constr_Array_Subt_Of_Unc_With_Controlled (Exp_Type)) + Is_Constr_Array_Subt_Of_Unc_With_Controlled (Und_Typ)) and then Nkind (Parent (Exp)) /= N_Object_Declaration and then not Is_Expression_Of_Func_Return (Exp) then @@ -12904,11 +12909,11 @@ package body Exp_Util is Decl := Make_Object_Declaration (Loc, Defining_Identifier => Obj, - Object_Definition => New_Occurrence_Of (Exp_Type, Loc), + Object_Definition => New_Occurrence_Of (Typ, Loc), Expression => Relocate_Node (Exp)); Insert_Action (Exp, Decl); - Set_Etype (Obj, Exp_Type); + Set_Etype (Obj, Typ); Rewrite (Exp, New_Occurrence_Of (Obj, Loc)); goto Leave; end; @@ -12924,7 +12929,7 @@ package body Exp_Util is if GNATprove_Mode then Res := New_Occurrence_Of (Def_Id, Loc); - Ref_Type := Exp_Type; + Ref_Type := Typ; -- Regular expansion utilizing an access type and 'reference @@ -12934,7 +12939,7 @@ package body Exp_Util is Prefix => New_Occurrence_Of (Def_Id, Loc)); -- Generate: - -- type Ann is access all ; + -- type Ann is access all Typ; Ref_Type := Make_Temporary (Loc, 'A'); @@ -12944,8 +12949,7 @@ package body Exp_Util is Type_Definition => Make_Access_To_Object_Definition (Loc, All_Present => True, - Subtype_Indication => - New_Occurrence_Of (Exp_Type, Loc))); + Subtype_Indication => New_Occurrence_Of (Typ, Loc))); Insert_Action (Exp, Ptr_Typ_Decl); end if; @@ -12974,16 +12978,16 @@ package body Exp_Util is if not Analyzed (Exp) and then Nkind (Exp) = N_Aggregate - and then (Is_Array_Type (Exp_Type) - or else Has_Discriminants (Exp_Type)) - and then Is_Constrained (Exp_Type) + and then (Is_Array_Type (Und_Typ) + or else Has_Discriminants (Und_Typ)) + and then Is_Constrained (Und_Typ) then -- Do not suppress checks associated with the qualified -- expression we are about to introduce (unless those -- checks were already suppressed when Remove_Side_Effects -- was called). - if Is_Array_Type (Exp_Type) then + if Is_Array_Type (Und_Typ) then Scope_Suppress.Suppress (Length_Check) := Svg_Suppress.Suppress (Length_Check); else @@ -12991,9 +12995,10 @@ package body Exp_Util is Svg_Suppress.Suppress (Discriminant_Check); end if; - E := Make_Qualified_Expression (Loc, - Subtype_Mark => New_Occurrence_Of (Exp_Type, Loc), - Expression => E); + E := + Make_Qualified_Expression (Loc, + Subtype_Mark => New_Occurrence_Of (Typ, Loc), + Expression => E); end if; New_Exp := Make_Reference (Loc, E); @@ -13041,7 +13046,7 @@ package body Exp_Util is -- Finally rewrite the original expression and we are done Rewrite (Exp, Res); - Analyze_And_Resolve (Exp, Exp_Type); + Analyze_And_Resolve (Exp, Typ); <> Scope_Suppress := Svg_Suppress; diff --git a/gcc/ada/fmap.adb b/gcc/ada/fmap.adb index 4f20231365dd..0ad24b317933 100644 --- a/gcc/ada/fmap.adb +++ b/gcc/ada/fmap.adb @@ -191,8 +191,8 @@ package body Fmap is begin Unit_Hash_Table.Reset; File_Hash_Table.Reset; - Path_Mapping.Set_Last (0); - File_Mapping.Set_Last (0); + Path_Mapping.Clear; + File_Mapping.Clear; Last_In_Table := 0; end Empty_Tables; diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index 73515157f2f8..68a3c143dd13 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -19,7 +19,7 @@ @copying @quotation -GNAT Reference Manual , Sep 29, 2025 +GNAT Reference Manual , Oct 17, 2025 AdaCore @@ -33627,7 +33627,7 @@ historical compatibility purposes. @section PolyORB -AWS is a deprecated product. It will be baselined with the GNAT Pro +PolyORB is a deprecated product. It will be baselined with the GNAT Pro release 28. After this release, there will be no new versions of this product. Contact your sales representative or send a message to @email{sales@@adacore.com} to get recommendations for replacements. diff --git a/gcc/ada/libgnarl/s-taprop__qnx.adb b/gcc/ada/libgnarl/s-taprop__qnx.adb index b51f2b527082..c9a98e9eaa11 100644 --- a/gcc/ada/libgnarl/s-taprop__qnx.adb +++ b/gcc/ada/libgnarl/s-taprop__qnx.adb @@ -96,6 +96,22 @@ package body System.Task_Primitives.Operations is Unblocked_Signal_Mask : aliased sigset_t; -- The set of signals that should unblocked in all tasks + Default_Signal_Mask : aliased sigset_t; + -- Default signal mask, used to restore signal mask after thread creation + + Default_Signal_Mask_Initialized : Boolean := False; + -- Allow to not enable default signals if the default signal mask failed to + -- initialize. + + procedure Disable_Signals; + -- Disable signals before calling pthread_create to avoid a potential + -- memory leak on QNX. + + procedure Enable_Signals; + -- Enable signals after pthread_create and in the created task. Since the + -- created task inherits the disabled signals from the parent they have to + -- be enabled for each task separately. + -- The followings are internal configuration constants needed Next_Serial_Number : Task_Serial_Number := 100; @@ -654,6 +670,7 @@ package body System.Task_Primitives.Operations is procedure Enter_Task (Self_ID : Task_Id) is begin + Enable_Signals; Self_ID.Common.LL.LWP := lwp_self; Specific.Set (Self_ID); @@ -765,17 +782,6 @@ package body System.Task_Primitives.Operations is function Thread_Body_Access is new Ada.Unchecked_Conversion (System.Address, Thread_Body); - - function Disable_Signals return Interfaces.C.int with - Import, - Convention => C, - External_Name => "__gnat_disable_signals"; - - function Enable_Signals return Interfaces.C.int with - Import, - Convention => C, - External_Name => "__gnat_enable_signals"; - begin Adjusted_Stack_Size := Interfaces.C.size_t (Stack_Size + Alternate_Stack_Size); @@ -862,20 +868,17 @@ package body System.Task_Primitives.Operations is -- Restricted.Stages is used). One can verify that by inspecting the -- Task_Wrapper procedures. - Result := Disable_Signals; - pragma Assert (Result = 0); + Disable_Signals; Result := pthread_create (T.Common.LL.Thread'Access, Attributes'Access, Thread_Body_Access (Wrapper), To_Address (T)); pragma Assert (Result = 0 or else Result = EAGAIN); + Enable_Signals; Succeeded := Result = 0; - Result := Enable_Signals; - pragma Assert (Result = 0); - Result := pthread_attr_destroy (Attributes'Access); pragma Assert (Result = 0); end Create_Task; @@ -1292,6 +1295,10 @@ package body System.Task_Primitives.Operations is end if; end loop; + Result := pthread_sigmask + (SIG_SETMASK, null, Default_Signal_Mask'Access); + Default_Signal_Mask_Initialized := Result = 0; + -- Initialize the lock used to synchronize chain of all ATCBs Initialize_Lock (Single_RTS_Lock'Access, RTS_Lock_Level); @@ -1378,4 +1385,56 @@ package body System.Task_Primitives.Operations is pragma Assert (Result = 0); end Set_Task_Affinity; + --------------------- + -- Disable_Signals -- + --------------------- + + procedure Disable_Signals + is + Set : aliased sigset_t; + Result : Interfaces.C.int; + begin + -- If the default signal mask is not initialized there is no point in + -- disabling signals since we can't enable them again. Not enabling them + -- might impact the runtimes functionality so we rather accept the + -- possible memory leak. + if not Default_Signal_Mask_Initialized then + return; + end if; + + -- If any of the operations of setting up the signal mask fails we abort + -- disabling the signals. The function to enable the signals doesn't + -- need to care about this. It will simply restore the default signal + -- mask if it was successfully initialized. If the signals are not + -- disabled this is a no-op. + Result := sigemptyset (Set'Access); + if Result /= 0 then + return; + end if; + for S in SIGHUP .. SIGXFSZ loop + Result := sigaddset (Set'Access, Signal (S)); + if Result /= 0 then + return; + end if; + end loop; + Result := pthread_sigmask (SIG_BLOCK, Set'Access, null); + pragma Assert (Result = 0); + end Disable_Signals; + + -------------------- + -- Enable_Signals -- + -------------------- + + procedure Enable_Signals + is + Result : Interfaces.C.int; + begin + if not Default_Signal_Mask_Initialized then + return; + end if; + Result := pthread_sigmask + (SIG_SETMASK, Default_Signal_Mask'Access, null); + pragma Assert (Result = 0); + end Enable_Signals; + end System.Task_Primitives.Operations; diff --git a/gcc/ada/par-ch4.adb b/gcc/ada/par-ch4.adb index f8ae9970c88e..338be465513a 100644 --- a/gcc/ada/par-ch4.adb +++ b/gcc/ada/par-ch4.adb @@ -485,7 +485,8 @@ package body Ch4 is -- Attribute Unsigned_Base_Range temporarily disabled if not Is_Attribute_Name (Attr_Name) - or else Attr_Name = Name_Unsigned_Base_Range + or else (Attr_Name = Name_Unsigned_Base_Range + and then not Debug_Flag_Dot_U) then if Apostrophe_Should_Be_Semicolon then Expr_Form := EF_Name; diff --git a/gcc/ada/par_sco.adb b/gcc/ada/par_sco.adb index 032bcf02adb6..3575ad5f3dbd 100644 --- a/gcc/ada/par_sco.adb +++ b/gcc/ada/par_sco.adb @@ -2888,8 +2888,7 @@ package body Par_SCO is end; end loop; - -- Clear the pending decisions list - Pending_Decisions.Set_Last (0); + Pending_Decisions.Clear; end Process_Pending_Decisions; ----------------------------- diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index 24d276ba48ae..deb19ee118e1 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -480,14 +480,16 @@ package body Sem_Ch12 is -- Create a new access type with the given designated type function Analyze_Associations - (N : Node_Id; - Formals : List_Id; - F_Copy : List_Id) return List_Id; + (N : Node_Id; + Formals : List_Id; + F_Copy : List_Id; + Parent_Installed : Boolean) return List_Id; -- At instantiation time, build the list of associations between formals -- and actuals. Each association becomes a renaming declaration for the -- formal entity. N is the instantiation node. Formals is the list of - -- unanalyzed formals. F_Copy is the analyzed list of formals in the - -- generic copy. + -- unanalyzed formals. F_Copy is the list of analyzed formals in the + -- generic copy. Parent_Installed is True if the parent has been installed + -- during the instantiation. procedure Analyze_Subprogram_Instantiation (N : Node_Id; @@ -838,9 +840,12 @@ package body Sem_Ch12 is -- the same list it is passing to Actual_Decls. function Instantiate_Formal_Subprogram - (Formal : Node_Id; - Actual : Node_Id; - Analyzed_Formal : Node_Id) return Node_Id; + (Formal : Node_Id; + Actual : Node_Id; + Analyzed_Formal : Node_Id; + Parent_Installed : Boolean) return Node_Id; + -- Parent_Installed is True if the parent has been installed during the + -- instantiation. function Instantiate_Formal_Package (Formal : Node_Id; @@ -1283,12 +1288,14 @@ package body Sem_Ch12 is procedure Analyze_One_Association (N : Node_Id; Assoc : Associations.Assoc_Rec; + Parent_Installed : Boolean; Result_Renamings : List_Id; Default_Actuals : List_Id; Actuals_To_Freeze : Elist_Id); - -- Called by Analyze_Associations for each association. The renamings - -- are appended onto Result_Renamings. Defaulted actuals are appended - -- onto Default_Actuals, and actuals that require freezing are + -- Called by Analyze_Associations for each association. Parent_Installed + -- is True if the parent has been installed during the instantiation. The + -- renamings are appended onto Result_Renamings. The defaulted actuals are + -- appended onto Default_Actuals, and actuals that require freezing are -- appended onto Actuals_To_Freeze. procedure Analyze_Structural_Associations @@ -2362,9 +2369,10 @@ package body Sem_Ch12 is -------------------------- function Analyze_Associations - (N : Node_Id; - Formals : List_Id; - F_Copy : List_Id) return List_Id + (N : Node_Id; + Formals : List_Id; + F_Copy : List_Id; + Parent_Installed : Boolean) return List_Id is use Associations; @@ -2412,6 +2420,7 @@ package body Sem_Ch12 is Analyze_One_Association (N, Assoc, + Parent_Installed, Result_Renamings, Default_Actuals, Actuals_To_Freeze); @@ -2470,6 +2479,7 @@ package body Sem_Ch12 is procedure Analyze_One_Association (N : Node_Id; Assoc : Associations.Assoc_Rec; + Parent_Installed : Boolean; Result_Renamings : List_Id; Default_Actuals : List_Id; Actuals_To_Freeze : Elist_Id) @@ -2736,7 +2746,10 @@ package body Sem_Ch12 is else Append_To (Result_Renamings, Instantiate_Formal_Subprogram - (Assoc.Un_Formal, Match, Assoc.An_Formal)); + (Assoc.Un_Formal, + Match, + Assoc.An_Formal, + Parent_Installed)); -- If formal subprogram has contracts, create wrappers -- for it. This is an expansion activity that cannot @@ -3557,7 +3570,7 @@ package body Sem_Ch12 is -- List of primitives made temporarily visible in the instantiation -- to match the visibility of the formal type. - function Build_Local_Package return Node_Id; + function Build_Local_Package (Parent_Installed : Boolean) return Node_Id; -- The formal package is rewritten so that its parameters are replaced -- with corresponding declarations. For parameters with bona fide -- associations these declarations are created by Analyze_Associations @@ -3569,7 +3582,8 @@ package body Sem_Ch12 is -- Build_Local_Package -- ------------------------- - function Build_Local_Package return Node_Id is + function Build_Local_Package (Parent_Installed : Boolean) return Node_Id + is Decls : List_Id; Pack_Decl : Node_Id; @@ -3639,15 +3653,16 @@ package body Sem_Ch12 is Instantiating => True); begin - Generic_Renamings.Set_Last (0); + Generic_Renamings.Clear; Generic_Renamings_HTable.Reset; Instantiation_Node := N; Decls := Analyze_Associations - (N => Original_Node (N), - Formals => Generic_Formal_Declarations (Act_Tree), - F_Copy => Generic_Formal_Declarations (Gen_Decl)); + (N => Original_Node (N), + Formals => Generic_Formal_Declarations (Act_Tree), + F_Copy => Generic_Formal_Declarations (Gen_Decl), + Parent_Installed => Parent_Installed); Vis_Prims_List := Check_Hidden_Primitives (Decls); end; @@ -3782,7 +3797,7 @@ package body Sem_Ch12 is -- internal declarations. begin - New_N := Build_Local_Package; + New_N := Build_Local_Package (Parent_Installed); -- If there are errors in the parameter list, Analyze_Associations -- raises Instantiation_Error. Patch the declaration to prevent further @@ -3868,6 +3883,7 @@ package body Sem_Ch12 is Renaming_In_Par := Make_Defining_Identifier (Loc, Chars (Gen_Unit)); Mutate_Ekind (Renaming_In_Par, E_Package); + Set_Is_Internal (Renaming_In_Par); Set_Is_Not_Self_Hidden (Renaming_In_Par); Set_Etype (Renaming_In_Par, Standard_Void_Type); Set_Scope (Renaming_In_Par, Parent_Instance); @@ -4998,7 +5014,7 @@ package body Sem_Ch12 is -- inherited from formal packages of parent units, and these are -- constructed when the parents are installed. - Generic_Renamings.Set_Last (0); + Generic_Renamings.Clear; Generic_Renamings_HTable.Reset; -- Except for an abbreviated instance created to check a formal package, @@ -5159,9 +5175,10 @@ package body Sem_Ch12 is Renamings := Analyze_Associations - (N => N, - Formals => Generic_Formal_Declarations (Act_Tree), - F_Copy => Generic_Formal_Declarations (Gen_Decl)); + (N => N, + Formals => Generic_Formal_Declarations (Act_Tree), + F_Copy => Generic_Formal_Declarations (Gen_Decl), + Parent_Installed => Parent_Installed); -- Bail out if the instantiation has been turned into something else @@ -6718,7 +6735,7 @@ package body Sem_Ch12 is -- Remove package itself from visibility, so it does not -- conflict with subprogram. - Set_Name_Entity_Id (Chars (Pack_Id), Homonym (Pack_Id)); + Remove_Homonym (Pack_Id); -- Set name and scope of internal subprogram so that the proper -- external name will be generated. The proper scope is the scope @@ -6962,7 +6979,7 @@ package body Sem_Ch12 is -- Initialize renamings map, for error checking - Generic_Renamings.Set_Last (0); + Generic_Renamings.Clear; Generic_Renamings_HTable.Reset; Create_Instantiation_Source (N, Gen_Unit, S_Adjustment); @@ -6981,9 +6998,10 @@ package body Sem_Ch12 is Renamings := Analyze_Associations - (N => N, - Formals => Generic_Formal_Declarations (Act_Tree), - F_Copy => Generic_Formal_Declarations (Gen_Decl)); + (N => N, + Formals => Generic_Formal_Declarations (Act_Tree), + F_Copy => Generic_Formal_Declarations (Gen_Decl), + Parent_Installed => Parent_Installed); -- Bail out if the instantiation has been turned into something else @@ -7236,7 +7254,7 @@ package body Sem_Ch12 is Restore_Hidden_Primitives (Vis_Prims_List); Restore_Env; Env_Installed := False; - Generic_Renamings.Set_Last (0); + Generic_Renamings.Clear; Generic_Renamings_HTable.Reset; end if; @@ -12538,9 +12556,10 @@ package body Sem_Ch12 is ----------------------------------- function Instantiate_Formal_Subprogram - (Formal : Node_Id; - Actual : Node_Id; - Analyzed_Formal : Node_Id) return Node_Id + (Formal : Node_Id; + Actual : Node_Id; + Analyzed_Formal : Node_Id; + Parent_Installed : Boolean) return Node_Id is Analyzed_S : constant Entity_Id := Defining_Unit_Name (Specification (Analyzed_Formal)); @@ -12548,13 +12567,7 @@ package body Sem_Ch12 is Defining_Unit_Name (Specification (Formal)); function From_Parent_Scope (Subp : Entity_Id) return Boolean; - -- If the generic is a child unit, the parent has been installed on the - -- scope stack, but a default subprogram cannot resolve to something - -- on the parent because that parent is not really part of the visible - -- context (it is there to resolve explicit local entities). If the - -- default has resolved in this way, we remove the entity from immediate - -- visibility and analyze the node again to emit an error message or - -- find another visible candidate. + -- Return true if Subp is declared in a parent scope of Analyzed_S procedure Valid_Actual_Subprogram (Act : Node_Id); -- Perform legality check and raise exception on failure @@ -12812,21 +12825,31 @@ package body Sem_Ch12 is end if; -- Gather possible interpretations for the actual before analyzing the - -- instance. If overloaded, it will be resolved when analyzing the - -- renaming declaration. + -- instance. If the actual is overloaded, then it will be resolved when + -- the renaming declaration is analyzed. if Box_Present (Formal) and then No (Actual) then Analyze (Nam); - if Is_Child_Unit (Scope (Analyzed_S)) - and then Present (Entity (Nam)) + -- If the generic is a child unit and the parent has been installed + -- during this instantiation (as opposed to having been installed in + -- the context of the instantiation at some earlier point), a default + -- subprogram cannot resolve to something in the parent because the + -- parent is not really part of the visible context (it is there to + -- resolve explicit local entities). If the default subprogram has + -- been resolved in this way, we remove the entity from immediate + -- visibility and analyze the node again to emit an error message + -- or find another visible candidate. + + if Present (Entity (Nam)) + and then Is_Child_Unit (Scope (Analyzed_S)) + and then Parent_Installed then if not Is_Overloaded (Nam) then if From_Parent_Scope (Entity (Nam)) then Set_Is_Immediately_Visible (Entity (Nam), False); Set_Entity (Nam, Empty); Set_Etype (Nam, Empty); - Analyze (Nam); Set_Is_Immediately_Visible (Entity (Nam)); end if; @@ -13200,7 +13223,7 @@ package body Sem_Ch12 is -- to capture local names that may be hidden if the generic is -- a child unit. - if Nkind (Actual) = N_Aggregate then + if Nkind (Unqualify (Actual)) = N_Aggregate then Preanalyze_And_Resolve (Actual, Typ); end if; @@ -18698,9 +18721,8 @@ package body Sem_Ch12 is procedure Set_Instance_Of (A : Entity_Id; B : Entity_Id) is begin - Generic_Renamings.Table (Generic_Renamings.Last) := (A, B, Assoc_Null); + Generic_Renamings.Append ((A, B, Assoc_Null)); Generic_Renamings_HTable.Set (Generic_Renamings.Last); - Generic_Renamings.Increment_Last; end Set_Instance_Of; -------------------- @@ -19333,39 +19355,22 @@ package body Sem_Ch12 is -------------------- function Save_And_Reset return Context is + First : constant Integer := Integer (Generic_Renamings.First); + Last : constant Integer := Integer (Generic_Renamings.Last); begin - return Result : Context (0 .. Integer (Generic_Renamings.Last)) do + return Result : Context (First .. Last) do for Index in Result'Range loop declare Indexed_Assoc : Assoc renames Generic_Renamings.Table (Assoc_Ptr (Index)); Result_Pair : Binding_Pair renames Result (Index); begin - -- If we have called Increment_Last but have not yet - -- initialized the new last element of the table, then - -- that last element might be invalid. Saving and - -- restoring (especially restoring, it turns out) invalid - -- values can result in exceptions if predicate checking - -- is enabled, so replace invalid values with Empty. - - if Indexed_Assoc.Gen_Id'Valid then - Result_Pair.Formal_Id := Indexed_Assoc.Gen_Id; - else - pragma Assert (Index = Result'Last); - Result_Pair.Formal_Id := Empty; - end if; - - if Indexed_Assoc.Act_Id'Valid then - Result_Pair.Actual_Id := Indexed_Assoc.Act_Id; - else - pragma Assert (Index = Result'Last); - Result_Pair.Actual_Id := Empty; - end if; + Result_Pair.Formal_Id := Indexed_Assoc.Gen_Id; + Result_Pair.Actual_Id := Indexed_Assoc.Act_Id; end; end loop; Generic_Renamings.Init; - Generic_Renamings.Set_Last (-1); Generic_Renamings_HTable.Reset; end return; end Save_And_Reset; @@ -19377,13 +19382,10 @@ package body Sem_Ch12 is procedure Restore (Saved : Context) is begin Generic_Renamings.Init; - Generic_Renamings.Set_Last (0); Generic_Renamings_HTable.Reset; - Generic_Renamings.Increment_Last; for Pair of Saved loop Set_Instance_Of (Pair.Formal_Id, Pair.Actual_Id); end loop; - Generic_Renamings.Decrement_Last; end Restore; end Instance_Context; diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 22fea0d02907..f7be890536d0 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -1406,7 +1406,7 @@ package body Sem_Ch13 is Error_Msg_N ("nonoverridable aspect % of type % requires % " & Operation_Kind & "# to be a primitive operation", - Original); + Expr); end; end if; end Check_Nonoverridable_Aspect_Subprograms; @@ -2372,7 +2372,13 @@ package body Sem_Ch13 is then if A_Id = Aspect_Import then Set_Has_Completion (E); - Set_Is_Imported (E); + + -- Do not set Is_Imported on Exceptions, similarly + -- to Sem_Prag.Process_Import_Or_Interface. + + if Ekind (E) /= E_Exception then + Set_Is_Imported (E); + end if; -- An imported object cannot be explicitly initialized @@ -3590,6 +3596,7 @@ package body Sem_Ch13 is | Aspect_Effective_Reads | Aspect_Effective_Writes | Aspect_Preelaborable_Initialization + | Aspect_Unsigned_Base_Range then Error_Msg_Name_1 := Nam; @@ -3703,6 +3710,13 @@ package body Sem_Ch13 is then Delay_Required := False; + -- For Unsigned_Base_Range aspect, do not delay becase we + -- need to process it before any type or subtype derivation + -- is analyzed. + + elsif A_Id in Aspect_Unsigned_Base_Range then + Delay_Required := False; + -- All other cases are delayed else diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 9ca77089d1a3..aa15166fa860 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -11287,7 +11287,13 @@ package body Sem_Ch3 is -- not. It is OK for the new bound we are creating, but not for -- the old one??? Still if it never happens, no problem. - Analyze_And_Resolve (Bound, Base_Type (Par_T)); + -- This must be disabled on unsigned base range types because their + -- base type is a modular type, and their type is a signed integer + -- type. + + if not Has_Unsigned_Base_Range_Aspect (Base_Type (Par_T)) then + Analyze_And_Resolve (Bound, Base_Type (Par_T)); + end if; if Nkind (Bound) in N_Integer_Literal | N_Real_Literal then New_Bound := New_Copy (Bound); diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb index 2002cc7621fd..989e6bfd2d01 100644 --- a/gcc/ada/sem_ch7.adb +++ b/gcc/ada/sem_ch7.adb @@ -2266,7 +2266,32 @@ package body Sem_Ch7 is Next_Elmt (Op_Elmt_2); end loop; - -- Case 2: We have not found any explicit overriding and + -- Case 2: For a formal type, we need to explicitly check + -- whether a local subprogram hides from all visibility + -- the implicitly declared primitive, because subprograms + -- declared in a generic package specification are never + -- primitive for a formal type, even if they happen to + -- override an operation of the type (RM 3.2.3(7.d/2)). + + if Is_Generic_Type (E) then + declare + S : Entity_Id; + + begin + S := E; + while Present (S) loop + if Chars (S) = Chars (Parent_Subp) + and then Type_Conformant (Prim_Op, S) + then + goto Next_Primitive; + end if; + + Next_Entity (S); + end loop; + end; + end if; + + -- Case 3: We have not found any explicit overriding and -- hence we need to declare the operation (i.e., make it -- visible). diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index 86344b59c7ef..e9d00d0d4a29 100644 --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -7225,6 +7225,8 @@ package body Sem_Ch8 is begin while Present (Id) loop + -- The immediate case is when Id is an entity of the prefix + if Scope (Id) = P_Name then Candidate := Id; Is_New_Candidate := True; @@ -7250,6 +7252,53 @@ package body Sem_Ch8 is end if; end if; + -- If the name of a generic child unit appears within an instance + -- of itself, then it is resolved to the renaming of the name of + -- the instance built in Sem_Ch12, so we get to the generic parent + -- through the renaming. + + elsif Ekind (Id) in E_Function | E_Package | E_Procedure + and then Present (Renamed_Entity (Id)) + and then Is_Generic_Instance (Renamed_Entity (Id)) + and then In_Open_Scopes (Renamed_Entity (Id)) + then + declare + Gen_Inst : constant Entity_Id := Renamed_Entity (Id); + Gen_Par : constant Entity_Id := + Generic_Parent + (Specification (Unit_Declaration_Node (Gen_Inst))); + + begin + -- The easy case is when Gen_Par is an entity of the prefix + + if Scope (Gen_Par) = P_Name then + Is_New_Candidate := True; + + -- Now the prefix may also be within an instance of itself, + -- but we do not need to go through the renaming for it, as + -- this was done on entry to the procedure. + + elsif Is_Generic_Instance (P_Name) + and then In_Open_Scopes (P_Name) + then + declare + Gen_Par_P : constant Entity_Id := + Generic_Parent + (Specification (Unit_Declaration_Node (P_Name))); + + begin + if Scope (Gen_Par) = Gen_Par_P then + Is_New_Candidate := True; + else + Is_New_Candidate := False; + end if; + end; + + else + Is_New_Candidate := False; + end if; + end; + -- Ada 2005 (AI-217): Handle shadow entities associated with -- types declared in limited-withed nested packages. We don't need -- to handle E_Incomplete_Subtype entities because the entities @@ -7284,22 +7333,6 @@ package body Sem_Ch8 is Candidate := Get_Full_View (Id); Is_New_Candidate := True; - -- An unusual case arises with a fully qualified name for an - -- entity local to a generic child unit package, within an - -- instantiation of that package. The name of the unit now - -- denotes the renaming created within the instance. This is - -- only relevant in an instance body, see below. - - elsif Is_Generic_Instance (Scope (Id)) - and then In_Open_Scopes (Scope (Id)) - and then In_Instance_Body - and then Ekind (Scope (Id)) = E_Package - and then Ekind (Id) = E_Package - and then Renamed_Entity (Id) = Scope (Id) - and then Is_Immediately_Visible (P_Name) - then - Is_New_Candidate := True; - else Is_New_Candidate := False; end if; @@ -7434,55 +7467,6 @@ package body Sem_Ch8 is end if; else - -- Within the instantiation of a child unit, the prefix may - -- denote the parent instance, but the selector has the name - -- of the original child. That is to say, when A.B appears - -- within an instantiation of generic child unit B, the scope - -- stack includes an instance of A (P_Name) and an instance - -- of B under some other name. We scan the scope to find this - -- child instance, which is the desired entity. - -- Note that the parent may itself be a child instance, if - -- the reference is of the form A.B.C, in which case A.B has - -- already been rewritten with the proper entity. - - if In_Open_Scopes (P_Name) - and then Is_Generic_Instance (P_Name) - then - declare - Gen_Par : constant Entity_Id := - Generic_Parent (Specification - (Unit_Declaration_Node (P_Name))); - S : Entity_Id := Current_Scope; - P : Entity_Id; - - begin - for J in reverse 0 .. Scope_Stack.Last loop - S := Scope_Stack.Table (J).Entity; - - exit when S = Standard_Standard; - - if Ekind (S) in E_Function | E_Package | E_Procedure - then - P := - Generic_Parent (Specification - (Unit_Declaration_Node (S))); - - -- Check that P is a generic child of the generic - -- parent of the prefix. - - if Present (P) - and then Chars (P) = Chars (Selector) - and then Scope (P) = Gen_Par - then - Id := S; - goto Found; - end if; - end if; - - end loop; - end; - end if; - -- If this is a selection from Ada, System or Interfaces, then -- we assume a missing with for the corresponding package. @@ -7589,7 +7573,6 @@ package body Sem_Ch8 is end if; end if; - <> if Comes_From_Source (N) and then Is_Remote_Access_To_Subprogram_Type (Id) and then Ekind (Id) = E_Access_Subprogram_Type diff --git a/gcc/ada/sem_elab.adb b/gcc/ada/sem_elab.adb index 0ce2b35305a1..4d57a86529a2 100644 --- a/gcc/ada/sem_elab.adb +++ b/gcc/ada/sem_elab.adb @@ -17469,7 +17469,7 @@ package body Sem_Elab is -- Stuff that happens only at the outer level if No (Outer_Scope) then - Elab_Visited.Set_Last (0); + Elab_Visited.Clear; -- Nothing to do if current scope is Standard (this is a bit odd, but -- it happens in the case of generic instantiations). diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 6b38de037bf9..0dc2e4f56bf1 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -10699,6 +10699,9 @@ package body Sem_Prag is -- the External_Name). For exceptions, the External_Name is the -- name of the RTTI structure. + -- Do not call Set_Is_Imported as that would disable the output + -- of the needed exception data structures. + -- ??? Emit an error if pragma Import/Export_Exception is present elsif Nkind (Parent (Def_Id)) = N_Incomplete_Type_Declaration then @@ -12690,7 +12693,8 @@ package body Sem_Prag is -- Pragma Unsigned_Base_Range temporarily disabled if not Is_Pragma_Name (Pname) - or else Pname = Name_Unsigned_Base_Range + or else (Pname = Name_Unsigned_Base_Range + and then not Debug_Flag_Dot_U) then declare Msg_Issued : Boolean := False; @@ -28154,12 +28158,23 @@ package body Sem_Prag is then Error_Pragma_Arg ("cannot apply pragma %", - "\& is not a signed integer type", - Arg1); + "\& is not a signed integer type", Arg1); elsif Is_Derived_Type (E) then Error_Pragma_Arg ("pragma % cannot apply to derived type", Arg1); + + elsif Is_Generic_Type (E) then + Error_Pragma_Arg + ("pragma % cannot apply to formal type", Arg1); + + elsif Present (Expr) + and then Is_False (Expr_Value (Expr)) + and then Ekind (Base_Type (E)) = E_Modular_Integer_Type + and then Has_Unsigned_Base_Range_Aspect (Base_Type (E)) + then + Error_Pragma_Arg + ("pragma % can only confirm previous True value", Arg1); end if; Check_First_Subtype (Arg1); @@ -28167,17 +28182,19 @@ package body Sem_Prag is -- Create the new unsigned integer base type entity, and apply -- the constraint to create the first subtype of E. - Unsigned_Base_Range_Type_Declaration (E, - Def => Type_Definition (Parent (E))); + if No (Expr) or else Is_True (Expr_Value (Expr)) then + Unsigned_Base_Range_Type_Declaration (E, + Def => Type_Definition (Parent (E))); - Set_Direct_Primitive_Operations (Base_Type (E), New_Elmt_List); - Set_Direct_Primitive_Operations (E, - Direct_Primitive_Operations (Base_Type (E))); - Ensure_Freeze_Node (Base_Type (E)); - Set_First_Subtype_Link (Freeze_Node (Base_Type (E)), E); - Set_Has_Delayed_Freeze (E); + Set_Direct_Primitive_Operations (Base_Type (E), New_Elmt_List); + Set_Direct_Primitive_Operations (E, + Direct_Primitive_Operations (Base_Type (E))); + Ensure_Freeze_Node (Base_Type (E)); + Set_First_Subtype_Link (Freeze_Node (Base_Type (E)), E); + Set_Has_Delayed_Freeze (E); - Set_Has_Unsigned_Base_Range_Aspect (Base_Type (E)); + Set_Has_Unsigned_Base_Range_Aspect (Base_Type (E)); + end if; end Unsigned_Base_Range; ---------------- @@ -28770,6 +28787,17 @@ package body Sem_Prag is OK : Boolean; Chr : Character; + function Enclose_Ending_Space + (Raw_Str : String) return String + is (if Raw_Str (Raw_Str'Last) = ' ' + then '"' & Raw_Str & '"' + else Raw_Str); + function Enclose_Ending_Space + (Raw_Chr : Character) return String + is (Enclose_Ending_Space ((1 => Raw_Chr))); + -- This function ensures that no error message ends + -- with a space, in case we enclose it within quotes. + begin J := 1; while J <= Len loop @@ -28801,7 +28829,8 @@ package body Sem_Prag is if not Set_Warning_Switch ('.', Chr) then Error_Pragma_Arg ("invalid warning switch character " - & '.' & Chr, Arg1); + & Enclose_Ending_Space ('.' & Chr), + Arg1); end if; -- Non-Dot case @@ -28812,7 +28841,8 @@ package body Sem_Prag is if not OK then Error_Pragma_Arg - ("invalid warning switch character " & Chr, + ("invalid warning switch character " + & Enclose_Ending_Space (Chr), Arg1); end if; diff --git a/gcc/ada/sem_type.adb b/gcc/ada/sem_type.adb index 32d0833f3a82..31a2acdfc646 100644 --- a/gcc/ada/sem_type.adb +++ b/gcc/ada/sem_type.adb @@ -610,14 +610,17 @@ package body Sem_Type is First_Interp := All_Interp.Last; Add_One_Interp (N, Ent, Etype (N)); - -- For expanded name, pick up all additional entities from the - -- same scope, since these are obviously also visible. Note that - -- these are not necessarily contiguous on the homonym chain. + -- For an expanded name, pick up additional visible entities from + -- the same scope. Note that these are not necessarily contiguous + -- on the homonym chain. if Nkind (N) = N_Expanded_Name then H := Homonym (Ent); while Present (H) loop - if Scope (H) = Scope (Entity (N)) then + if Scope (H) = Scope (Entity (N)) + and then (not Is_Hidden (H) + or else Is_Immediately_Visible (H)) + then Add_One_Interp (N, H, Etype (H)); end if; diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 7f864d66ffaf..a8984c89cf29 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -5881,18 +5881,20 @@ package body Sem_Util is -- Test whether the result type or any of the parameter types of -- each subprogram following the type match that type when the - -- type is declared in a package spec, is a derived type, or the - -- subprogram is marked as primitive. (The Is_Primitive test is - -- needed to find primitives of nonderived types in declarative - -- parts that happen to override the predefined "=" operator.) - - -- Note that generic formal subprograms are not considered to be - -- primitive operations and thus are never inherited. + -- type is declared in a package spec, the subprogram is marked as + -- primitive, or the subprogram is inherited. Note that the + -- Is_Primitive test is needed to find primitives of nonderived + -- types in declarative parts that happen to override the + -- predefined "=" operator. if Is_Overloadable (Id) and then (Is_Type_In_Pkg - or else Is_Derived_Type (B_Type) - or else Is_Primitive (Id)) + or else Is_Primitive (Id) + or else not Comes_From_Source (Id)) + + -- Generic formal subprograms are not considered to be primitive + -- operations and thus are never inherited. + and then Parent_Kind (Parent (Id)) not in N_Formal_Subprogram_Declaration and then not Is_Child_Unit (Id) diff --git a/gcc/ada/table.adb b/gcc/ada/table.adb index 31891de87db4..f803fc8f3f5f 100644 --- a/gcc/ada/table.adb +++ b/gcc/ada/table.adb @@ -130,7 +130,7 @@ package body Table is begin Locked := False; - Last_Val := Min - 1; + Clear; Max := Min + (Table_Initial * Table_Factor) - 1; Length := Max - Min + 1; @@ -372,6 +372,24 @@ package body Table is end if; end Set_Item; + ----------- + -- Clear -- + ----------- + + procedure Clear is + begin + Last_Val := Min - 1; + end Clear; + + -------------- + -- Is_Empty -- + -------------- + + function Is_Empty return Boolean is + begin + return Last_Val = Min - 1; + end Is_Empty; + -------------- -- Set_Last -- -------------- diff --git a/gcc/ada/table.ads b/gcc/ada/table.ads index 623ce14711b9..94bb8287cd48 100644 --- a/gcc/ada/table.ads +++ b/gcc/ada/table.ads @@ -204,6 +204,13 @@ package Table is -- to Index. Item will replace any value already present in the table -- at this position. + procedure Clear; + -- Resets Last to its initial value, making the table have no elements. + -- No memory deallocation is performed. + + function Is_Empty return Boolean; + -- Returns whether the table is empty + type Saved_Table is private; -- Type used for Save/Restore subprograms diff --git a/gcc/btfout.cc b/gcc/btfout.cc index 5a210cd51e6c..eb794ff86944 100644 --- a/gcc/btfout.cc +++ b/gcc/btfout.cc @@ -1138,7 +1138,8 @@ btf_add_used_type_1 (ctf_container_ref ctfc, ctf_dtdef_ref dtd, /* Try to avoid chasing pointers to struct/union types if the underlying type isn't used. */ - if (check_ptr && seen_ptr && create_fixups) + if (check_ptr && seen_ptr && create_fixups + && kind != BTF_KIND_TYPEDEF) { ctf_dtdef_ref ref = dtd->ref_type; uint32_t ref_kind = btf_dtd_kind (ref); diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 1c8a2b8e25e4..d4982eba3779 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,14 @@ +2025-10-30 Qing Zhao + + * c-attribs.cc (handle_counted_by_attribute): Allow counted_by for + void pointer. Issue warnings when -Wpointer-arith is present. + +2025-10-27 Richard Biener + + PR middle-end/122325 + * c-opts.cc (c_common_init_options_struct): Remove set of + flag_default_complex_method. + 2025-10-22 Jakub Jelinek PR c++/122302 diff --git a/gcc/c-family/c-attribs.cc b/gcc/c-family/c-attribs.cc index 8ca767abbeba..28a034f6c065 100644 --- a/gcc/c-family/c-attribs.cc +++ b/gcc/c-family/c-attribs.cc @@ -2963,14 +2963,16 @@ handle_counted_by_attribute (tree *node, tree name, " array member field", name); *no_add_attrs = true; } - /* This attribute cannot be applied to a pointer to void type. */ + /* This attribute can be applied to a pointer to void type, but issue + warning when -Wpointer-arith is presenting. */ else if (TREE_CODE (TREE_TYPE (decl)) == POINTER_TYPE && TREE_CODE (TREE_TYPE (TREE_TYPE (decl))) == VOID_TYPE) { - error_at (DECL_SOURCE_LOCATION (decl), - "%qE attribute is not allowed for a pointer to void", - name); - *no_add_attrs = true; + if (warn_pointer_arith) + warning_at (DECL_SOURCE_LOCATION (decl), + OPT_Wpointer_arith, + "%qE attribute is used for a pointer to void", + name); } /* This attribute cannot be applied to a pointer to function type. */ else if (TREE_CODE (TREE_TYPE (decl)) == POINTER_TYPE diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 89a1bbe6d419..274e2a74f4e1 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,15 @@ +2025-10-30 Qing Zhao + + * c-typeck.cc (build_access_with_size_for_counted_by): When the element + type is void, assign size one as the element_size. + +2025-10-27 H.J. Lu + + PR c/122427 + * c-decl.cc (diagnose_mismatched_decls): For FUNCTION_DECL, if + OLDDECL has TYPE_ATTRIBUTES and NEWDECL doesn't, try the type + with the OLDDECL attributes. + 2025-10-24 Joseph Myers * c-parser.cc (c_parser_next_tokens_start_typename) diff --git a/gcc/c/c-decl.cc b/gcc/c/c-decl.cc index 061892ac95b8..2b31a4328f87 100644 --- a/gcc/c/c-decl.cc +++ b/gcc/c/c-decl.cc @@ -2337,10 +2337,40 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl, error ("conflicting type qualifiers for %q+D", newdecl); } else - error ("conflicting types for %q+D; have %qT", newdecl, newtype); - diagnose_arglist_conflict (newdecl, olddecl, newtype, oldtype); - locate_old_decl (olddecl); - return false; + { + if (TREE_CODE (olddecl) == FUNCTION_DECL) + { + tree attrs = TYPE_ATTRIBUTES (TREE_TYPE (olddecl)); + if (attrs && !TYPE_ATTRIBUTES (TREE_TYPE (newdecl))) + { + /* Similar to the C++ front-end, for FUNCTION_DECL, + if OLDDECL has attributes and NEWDECL doesn't, + try the type with OLDDECL attributes. */ + tree rettype = TREE_TYPE (newtype); + tree tryargs = TYPE_ARG_TYPES (newtype); + tree trytype = c_build_function_type (rettype, + tryargs); + trytype = c_build_type_attribute_variant (trytype, + attrs); + if (comptypes (oldtype, trytype)) + { + *newtypep = newtype = trytype; + comptypes_result = 1; + } + } + } + + if (!comptypes_result) + error ("conflicting types for %q+D; have %qT", newdecl, + newtype); + } + if (!comptypes_result) + { + diagnose_arglist_conflict (newdecl, olddecl, newtype, + oldtype); + locate_old_decl (olddecl); + return false; + } } } /* Warn about enum/integer type mismatches. They are compatible types diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc index 371583bd64ed..bc0fb6b59e55 100644 --- a/gcc/c/c-typeck.cc +++ b/gcc/c/c-typeck.cc @@ -3179,7 +3179,10 @@ build_access_with_size_for_counted_by (location_t loc, tree ref, tree result_type = is_fam ? c_build_pointer_type (TREE_TYPE (ref)) : TREE_TYPE (ref); - tree element_size = TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (ref))); + tree element_type = TREE_TYPE (TREE_TYPE (ref)); + tree element_size = VOID_TYPE_P (element_type) + ? build_one_cst (size_type_node) + : TYPE_SIZE_UNIT (element_type); tree first_param = is_fam ? c_fully_fold (array_to_pointer_conversion (loc, ref), diff --git a/gcc/cgraph.cc b/gcc/cgraph.cc index d1b2e2a162c0..ab09376a1a0d 100644 --- a/gcc/cgraph.cc +++ b/gcc/cgraph.cc @@ -2220,11 +2220,7 @@ cgraph_node::release_body (bool keep_arguments) if (!used_as_abstract_origin && DECL_INITIAL (decl)) DECL_INITIAL (decl) = error_mark_node; release_function_body (decl); - if (lto_file_data) - { - lto_free_function_in_decl_state_for_node (this); - lto_file_data = NULL; - } + lto_free_function_in_decl_state_for_node (this); if (flag_checking && clones) { /* It is invalid to release body before materializing clones except @@ -2336,10 +2332,7 @@ cgraph_node::remove (void) release_body (); } else - { - lto_free_function_in_decl_state_for_node (this); - lto_file_data = NULL; - } + lto_free_function_in_decl_state_for_node (this); decl = NULL; if (call_site_hash) diff --git a/gcc/cgraph.h b/gcc/cgraph.h index 069e007ab71c..a937d0a574af 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -37,10 +37,12 @@ extern void debuginfo_early_stop (void); class ipa_opt_pass_d; typedef ipa_opt_pass_d *ipa_opt_pass; -/* Symbol table consists of functions and variables. +/* Toplevel consists of functions, variables and assembly. TODO: add labels and CONST_DECLs. */ -enum symtab_type +enum toplevel_type { + TOPLEVEL_BASE, + TOPLEVEL_ASM, SYMTAB_SYMBOL, SYMTAB_FUNCTION, SYMTAB_VARIABLE @@ -100,18 +102,37 @@ enum symbol_partitioning_class SYMBOL_DUPLICATE }; +/* Base of all toplevel entries. + Inherited by symtab_node and asm_node. */ +struct GTY ((desc ("%h.type"), tag ("TOPLEVEL_BASE"))) toplevel_node { + /* Constructor. */ + explicit toplevel_node (toplevel_type t) + : lto_file_data (NULL), order (-1), type (t) + {} + + /* File stream where this node is being written to. */ + struct lto_file_decl_data * lto_file_data; + + /* Ordering of all cgraph nodes. */ + int order; + + /* Type of the node. */ + ENUM_BITFIELD (toplevel_type) type : 8; +}; + /* Base of all entries in the symbol table. The symtab_node is inherited by cgraph and varpol nodes. */ -struct GTY((desc ("%h.type"), tag ("SYMTAB_SYMBOL"), +struct GTY ((tag ("SYMTAB_SYMBOL"), chain_next ("%h.next"), chain_prev ("%h.previous"))) - symtab_node + symtab_node: public toplevel_node { public: friend class symbol_table; /* Constructor. */ - explicit symtab_node (symtab_type t) - : type (t), resolution (LDPR_UNKNOWN), definition (false), alias (false), + explicit symtab_node (toplevel_type t) + : toplevel_node (t), + resolution (LDPR_UNKNOWN), definition (false), alias (false), transparent_alias (false), weakref (false), cpp_implicit_alias (false), symver (false), analyzed (false), writeonly (false), refuse_visibility_changes (false), externally_visible (false), @@ -121,9 +142,9 @@ struct GTY((desc ("%h.type"), tag ("SYMTAB_SYMBOL"), used_from_other_partition (false), in_other_partition (false), address_taken (false), in_init_priority_hash (false), need_lto_streaming (false), offloadable (false), ifunc_resolver (false), - order (-1), next_sharing_asm_name (NULL), + next_sharing_asm_name (NULL), previous_sharing_asm_name (NULL), same_comdat_group (NULL), ref_list (), - alias_target (NULL), lto_file_data (NULL), aux (NULL), + alias_target (NULL), aux (NULL), x_comdat_group (NULL_TREE), x_section (NULL), m_uid (-1) {} @@ -498,9 +519,6 @@ struct GTY((desc ("%h.type"), tag ("SYMTAB_SYMBOL"), return m_uid; } - /* Type of the symbol. */ - ENUM_BITFIELD (symtab_type) type : 8; - /* The symbols resolution. */ ENUM_BITFIELD (ld_plugin_symbol_resolution) resolution : 8; @@ -609,9 +627,6 @@ struct GTY((desc ("%h.type"), tag ("SYMTAB_SYMBOL"), unsigned ifunc_resolver : 1; - /* Ordering of all symtab entries. */ - int order; - /* Declaration representing the symbol. */ tree decl; @@ -642,9 +657,6 @@ struct GTY((desc ("%h.type"), tag ("SYMTAB_SYMBOL"), Once alias is resolved, this pointer become NULL. */ tree alias_target; - /* File stream where this node is being written to. */ - struct lto_file_decl_data * lto_file_data; - void *GTY ((skip)) aux; /* Comdat group the symbol is in. Can be private if GGC allowed that. */ @@ -2224,13 +2236,14 @@ struct GTY((tag ("SYMTAB_VARIABLE"))) varpool_node : public symtab_node /* Every top level asm statement is put into a asm_node. */ -struct GTY(()) asm_node { +struct GTY ((tag ("TOPLEVEL_ASM"))) asm_node: public toplevel_node { + explicit asm_node (tree asm_str) + : toplevel_node (TOPLEVEL_ASM), next (NULL), asm_str (asm_str) + {} /* Next asm node. */ asm_node *next; /* String for this asm node. */ tree asm_str; - /* Ordering of all cgraph nodes. */ - int order; }; /* Report whether or not THIS symtab node is a function, aka cgraph_node. */ @@ -2253,6 +2266,47 @@ is_a_helper ::test (symtab_node *p) return p && p->type == SYMTAB_VARIABLE; } +/* Report whether or not THIS toplevel node is a function, aka cgraph_node. */ + +template <> +template <> +inline bool +is_a_helper ::test (toplevel_node *p) +{ + return p && p->type == SYMTAB_FUNCTION; +} + +/* Report whether or not THIS toplevel node is a variable, aka varpool_node. */ + +template <> +template <> +inline bool +is_a_helper ::test (toplevel_node *p) +{ + return p && p->type == SYMTAB_VARIABLE; +} + +/* Report whether or not THIS toplevel node is a symtab_node. */ + +template <> +template <> +inline bool +is_a_helper ::test (toplevel_node *p) +{ + return p && p->type >= SYMTAB_SYMBOL; +} + +/* Report whether or not THIS toplevel node is a toplevel assembly, aka + asm_node. */ + +template <> +template <> +inline bool +is_a_helper ::test (toplevel_node *p) +{ + return p && p->type == TOPLEVEL_ASM; +} + typedef void (*cgraph_edge_hook)(cgraph_edge *, void *); typedef void (*cgraph_node_hook)(cgraph_node *, void *); typedef void (*varpool_node_hook)(varpool_node *, void *); @@ -2919,10 +2973,8 @@ symbol_table::finalize_toplevel_asm (tree asm_str) { asm_node *node; - node = ggc_cleared_alloc (); - node->asm_str = asm_str; + node = new (ggc_cleared_alloc ()) asm_node (asm_str); node->order = order++; - node->next = NULL; if (asmnodes == NULL) asmnodes = node; diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md index a121a18f9a09..e7c459dceb3a 100644 --- a/gcc/config/aarch64/aarch64-simd.md +++ b/gcc/config/aarch64/aarch64-simd.md @@ -3223,6 +3223,7 @@ DONE; } ) + (define_insn "extend2" [(set (match_operand: 0 "register_operand" "=w") (float_extend: @@ -3232,6 +3233,29 @@ [(set_attr "type" "neon_fp_cvt_widen_s")] ) +/* A BF->SF is a shift left of 16, however shifts are expensive and the generic + middle-end expansion would force through DI move. Instead use EXT to do the + shift to get better throughput and don't go through GPRs. */ + +(define_expand "extendbfsf2" + [(set (match_operand:SF 0 "register_operand" "=w") + (float_extend:SF + (match_operand:BF 1 "register_operand" "w")))] + "TARGET_SIMD" +{ + rtx tmp0 = aarch64_gen_shareable_zero (V8BFmode); + rtx op0 = force_lowpart_subreg (V8BFmode, operands[1], BFmode); + rtx res = gen_reg_rtx (V8BFmode); + emit_insn (gen_aarch64_extv8bf (res, tmp0, op0, gen_int_mode (7, SImode))); + /* Subregs between floating point modes aren't allowed to change size, so go + through V4SFmode. */ + res = force_lowpart_subreg (V4SFmode, res, V8BFmode); + res = force_lowpart_subreg (SFmode, res, V4SFmode); + emit_move_insn (operands[0], res); + DONE; +}) + + ;; Float narrowing operations. (define_insn "aarch64_float_trunc_rodd_df" diff --git a/gcc/config/i386/i386-options.cc b/gcc/config/i386/i386-options.cc index dadcf7664c63..ba598a817f30 100644 --- a/gcc/config/i386/i386-options.cc +++ b/gcc/config/i386/i386-options.cc @@ -2917,7 +2917,7 @@ ix86_option_override_internal (bool main_args_p, else { opts->x_ix86_move_max = opts->x_prefer_vector_width_type; - if (opts_set->x_ix86_move_max == PVW_NONE) + if (opts->x_ix86_move_max == PVW_NONE) { if (TARGET_AVX512F_P (opts->x_ix86_isa_flags)) opts->x_ix86_move_max = PVW_AVX512; diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 218377a17703..b812d8b38233 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -27353,6 +27353,72 @@ (match_dup 0))] "peep2_reg_dead_p (2, operands[0])" [(set (match_dup 2) (match_dup 1))]) + +;; umax (a, add (a, b)) => [sum, ovf] = add (a, b); ovf ? a : sum +;; umin (a, add (a, b)) => [sum, ovf] = add (a, b); ovf ? sum : a + +(define_code_attr ovf_add_cmp [(umax "geu") (umin "ltu")]) + +(define_int_iterator ovf_comm [1 2]) + +(define_insn_and_split "*plus_within_3_" + [(set (match_operand:SWI248 0 "register_operand") + (umaxmin:SWI248 + (plus:SWI248 (match_operand:SWI248 1 "nonimmediate_operand") + (match_operand:SWI248 2 "")) + (match_dup ovf_comm))) + (clobber (reg:CC FLAGS_REG))] + "TARGET_CMOVE + && ix86_pre_reload_split ()" + "#" + "&& 1" + [(parallel + [(set (reg:CCC FLAGS_REG) + (compare:CCC + (plus:SWI248 (match_dup 1) (match_dup 2)) + (match_dup ovf_comm))) + (set (match_dup 3) + (plus:SWI248 (match_dup 1) (match_dup 2)))]) + (set (match_dup 0) + (if_then_else:SWI248 + ( (reg:CCC FLAGS_REG) (const_int 0)) + (match_dup 3) + (match_dup ovf_comm)))] +{ + operands[] = force_reg (mode, operands[]); + operands[3] = gen_reg_rtx (mode); +}) + +;; umax (a, sub (a, b)) => [diff, udf] = sub (a, b); udf ? diff : a +;; umin (a, sub (a, b)) => [diff, udf] = sub (a, b); udf ? a : diff + +(define_code_attr udf_sub_cmp [(umax "ltu") (umin "geu")]) + +(define_insn_and_split "*minus_within_3" + [(set (match_operand:SWI248 0 "register_operand") + (umaxmin:SWI248 + (minus:SWI248 (match_operand:SWI248 1 "nonimmediate_operand") + (match_operand:SWI248 2 "")) + (match_dup 1))) + (clobber (reg:CC FLAGS_REG))] + "TARGET_CMOVE + && ix86_pre_reload_split ()" + "#" + "&& 1" + [(parallel + [(set (reg:CC FLAGS_REG) + (compare:CC (match_dup 1) (match_dup 2))) + (set (match_dup 3) + (minus:SWI248 (match_dup 1) (match_dup 2)))]) + (set (match_dup 0) + (if_then_else:SWI248 + ( (reg:CC FLAGS_REG) (const_int 0)) + (match_dup 3) + (match_dup 1)))] +{ + operands[1] = force_reg (mode, operands[1]); + operands[3] = gen_reg_rtx (mode); +}) ;; Misc patterns (?) diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index 5eba99225c49..7d91585b05d1 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -643,6 +643,9 @@ (define_mode_iterator VI2_AVX512F [(V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX2") V8HI]) +(define_mode_iterator VI2_AVX10_2 + [(V32HI "TARGET_AVX10_2") (V16HI "TARGET_AVX2") V8HI]) + (define_mode_iterator VI2_AVX512VNNIBW [(V32HI "TARGET_AVX512BW || TARGET_AVX512VNNI") (V16HI "TARGET_AVX2") V8HI]) @@ -32334,8 +32337,8 @@ (define_expand "usdot_prod" [(match_operand: 0 "register_operand") - (match_operand:VI2_AVX512F 1 "register_operand") - (match_operand:VI2_AVX512F 2 "register_operand") + (match_operand:VI2_AVX10_2 1 "register_operand") + (match_operand:VI2_AVX10_2 2 "register_operand") (match_operand: 3 "register_operand")] "TARGET_AVXVNNIINT16 || TARGET_AVX10_2" { @@ -32352,8 +32355,8 @@ (define_expand "udot_prod" [(match_operand: 0 "register_operand") - (match_operand:VI2_AVX512F 1 "register_operand") - (match_operand:VI2_AVX512F 2 "register_operand") + (match_operand:VI2_AVX10_2 1 "register_operand") + (match_operand:VI2_AVX10_2 2 "register_operand") (match_operand: 3 "register_operand")] "TARGET_AVXVNNIINT16 || TARGET_AVX10_2" { diff --git a/gcc/config/loongarch/genopts/loongarch.opt.in b/gcc/config/loongarch/genopts/loongarch.opt.in index 39c1545e5408..f0c089a928ec 100644 --- a/gcc/config/loongarch/genopts/loongarch.opt.in +++ b/gcc/config/loongarch/genopts/loongarch.opt.in @@ -205,6 +205,10 @@ mmax-inline-memcpy-size= Target Joined RejectNegative UInteger Var(la_max_inline_memcpy_size) Init(1024) Save -mmax-inline-memcpy-size=SIZE Set the max size of memcpy to inline, default is 1024. +mbreak-code= +Target Joined UInteger Var(la_break_code) Init(-1) Save +-mbreak-code=CODE Use 'break CODE' for traps supposed to be unrecoverable, or an 'amswap.w' instruction leading to INE if CODE is out of range. + Enum Name(explicit_relocs) Type(int) The code model option names for -mexplicit-relocs: diff --git a/gcc/config/loongarch/lasx.md b/gcc/config/loongarch/lasx.md index eed4d2b186ba..7a91473e4020 100644 --- a/gcc/config/loongarch/lasx.md +++ b/gcc/config/loongarch/lasx.md @@ -146,9 +146,6 @@ ;; Only integer modes equal or larger than a word. (define_mode_iterator ILASX_DW [V4DI V8SI]) -;; Only integer modes smaller than a word. -(define_mode_iterator ILASX_HB [V16HI V32QI]) - ;; Only used for immediate set shuffle elements instruction. (define_mode_iterator LASX_WHB_W [V8SI V16HI V32QI V8SF]) @@ -834,59 +831,6 @@ [(set_attr "type" "simd_div") (set_attr "mode" "")]) -(define_insn "xor3" - [(set (match_operand:LASX 0 "register_operand" "=f,f,f") - (xor:LASX - (match_operand:LASX 1 "register_operand" "f,f,f") - (match_operand:LASX 2 "reg_or_vector_same_val_operand" "f,YC,Urv8")))] - "ISA_HAS_LASX" - "@ - xvxor.v\t%u0,%u1,%u2 - xvbitrevi.%v0\t%u0,%u1,%V2 - xvxori.b\t%u0,%u1,%B2" - [(set_attr "type" "simd_logic,simd_bit,simd_logic") - (set_attr "mode" "")]) - -(define_insn "ior3" - [(set (match_operand:LASX 0 "register_operand" "=f,f,f") - (ior:LASX - (match_operand:LASX 1 "register_operand" "f,f,f") - (match_operand:LASX 2 "reg_or_vector_same_val_operand" "f,YC,Urv8")))] - "ISA_HAS_LASX" - "@ - xvor.v\t%u0,%u1,%u2 - xvbitseti.%v0\t%u0,%u1,%V2 - xvori.b\t%u0,%u1,%B2" - [(set_attr "type" "simd_logic,simd_bit,simd_logic") - (set_attr "mode" "")]) - -(define_insn "and3" - [(set (match_operand:LASX 0 "register_operand" "=f,f,f") - (and:LASX - (match_operand:LASX 1 "register_operand" "f,f,f") - (match_operand:LASX 2 "reg_or_vector_same_val_operand" "f,YZ,Urv8")))] - "ISA_HAS_LASX" -{ - switch (which_alternative) - { - case 0: - return "xvand.v\t%u0,%u1,%u2"; - case 1: - { - rtx elt0 = CONST_VECTOR_ELT (operands[2], 0); - unsigned HOST_WIDE_INT val = ~UINTVAL (elt0); - operands[2] = loongarch_gen_const_int_vector (mode, val & (-val)); - return "xvbitclri.%v0\t%u0,%u1,%V2"; - } - case 2: - return "xvandi.b\t%u0,%u1,%B2"; - default: - gcc_unreachable (); - } -} - [(set_attr "type" "simd_logic,simd_bit,simd_logic") - (set_attr "mode" "")]) - (define_insn "one_cmpl2" [(set (match_operand:ILASX 0 "register_operand" "=f") (not:ILASX (match_operand:ILASX 1 "register_operand" "f")))] @@ -1035,16 +979,6 @@ [(set_attr "type" "simd_fmadd") (set_attr "mode" "")]) -(define_insn "fnma4" - [(set (match_operand:FLASX 0 "register_operand" "=f") - (fma:FLASX (neg:FLASX (match_operand:FLASX 1 "register_operand" "f")) - (match_operand:FLASX 2 "register_operand" "f") - (match_operand:FLASX 3 "register_operand" "0")))] - "ISA_HAS_LASX" - "xvfnmsub.\t%u0,%u1,%u2,%u0" - [(set_attr "type" "simd_fmadd") - (set_attr "mode" "")]) - (define_expand "sqrt2" [(set (match_operand:FLASX 0 "register_operand") (sqrt:FLASX (match_operand:FLASX 1 "register_operand")))] @@ -3633,69 +3567,38 @@ [(set_attr "type" "simd_store") (set_attr "mode" "DI")]) -(define_expand "vec_widen_add_hi_" +(define_expand "vec_widen___" [(match_operand: 0 "register_operand") - (any_extend: (match_operand:ILASX_HB 1 "register_operand")) - (any_extend: (match_operand:ILASX_HB 2 "register_operand"))] - "ISA_HAS_LASX" -{ - loongarch_expand_vec_widen_hilo (operands[0], operands[1], operands[2], - , true, "add"); - DONE; -}) - -(define_expand "vec_widen_add_lo_" - [(match_operand: 0 "register_operand") - (any_extend: (match_operand:ILASX_HB 1 "register_operand")) - (any_extend: (match_operand:ILASX_HB 2 "register_operand"))] - "ISA_HAS_LASX" -{ - loongarch_expand_vec_widen_hilo (operands[0], operands[1], operands[2], - , false, "add"); - DONE; -}) - -(define_expand "vec_widen_sub_hi_" - [(match_operand: 0 "register_operand") - (any_extend: (match_operand:ILASX_HB 1 "register_operand")) - (any_extend: (match_operand:ILASX_HB 2 "register_operand"))] - "ISA_HAS_LASX" -{ - loongarch_expand_vec_widen_hilo (operands[0], operands[1], operands[2], - , true, "sub"); - DONE; -}) - -(define_expand "vec_widen_sub_lo_" - [(match_operand: 0 "register_operand") - (any_extend: (match_operand:ILASX_HB 1 "register_operand")) - (any_extend: (match_operand:ILASX_HB 2 "register_operand"))] - "ISA_HAS_LASX" -{ - loongarch_expand_vec_widen_hilo (operands[0], operands[1], operands[2], - , false, "sub"); - DONE; -}) - -(define_expand "vec_widen_mult_hi_" - [(match_operand: 0 "register_operand") - (any_extend: (match_operand:ILASX_HB 1 "register_operand")) - (any_extend: (match_operand:ILASX_HB 2 "register_operand"))] + (match_operand:ILASX_WHB 1 "register_operand") + (match_operand:ILASX_WHB 2 "register_operand") + (any_extend (const_int 0)) + (addsub (const_int 0) (const_int 0)) + (const_int zero_one)] "ISA_HAS_LASX" { + rtx (*fn_even) (rtx, rtx, rtx) = +gen_lasx_xvwev__; + rtx (*fn_odd) (rtx, rtx, rtx) = +gen_lasx_xvwod__; loongarch_expand_vec_widen_hilo (operands[0], operands[1], operands[2], - , true, "mult"); + , fn_even, fn_odd); DONE; }) -(define_expand "vec_widen_mult_lo_" +(define_expand "vec_widen_mult__" [(match_operand: 0 "register_operand") - (any_extend: (match_operand:ILASX_HB 1 "register_operand")) - (any_extend: (match_operand:ILASX_HB 2 "register_operand"))] + (match_operand:ILASX_WHB 1 "register_operand") + (match_operand:ILASX_WHB 2 "register_operand") + (any_extend (const_int 0)) + (const_int zero_one)] "ISA_HAS_LASX" { + rtx (*fn_even) (rtx, rtx, rtx) = +gen_lasx_xvmulwev__; + rtx (*fn_odd) (rtx, rtx, rtx) = +gen_lasx_xvmulwod__; loongarch_expand_vec_widen_hilo (operands[0], operands[1], operands[2], - , false, "mult"); + , fn_even, fn_odd); DONE; }) diff --git a/gcc/config/loongarch/loongarch-protos.h b/gcc/config/loongarch/loongarch-protos.h index 6ecbe27218ca..bec436845aa1 100644 --- a/gcc/config/loongarch/loongarch-protos.h +++ b/gcc/config/loongarch/loongarch-protos.h @@ -198,7 +198,8 @@ extern void loongarch_register_frame_header_opt (void); extern void loongarch_expand_vec_cond_expr (machine_mode, machine_mode, rtx *); extern void loongarch_expand_vec_cond_mask_expr (machine_mode, machine_mode, rtx *); -extern void loongarch_expand_vec_widen_hilo (rtx, rtx, rtx, bool, bool, const char *); +extern void loongarch_expand_vec_widen_hilo (rtx, rtx, rtx, bool, + rtx (*)(rtx, rtx, rtx), rtx (*)(rtx, rtx, rtx)); /* Routines implemented in loongarch-c.c. */ void loongarch_cpu_cpp_builtins (cpp_reader *); @@ -217,7 +218,8 @@ extern void loongarch_emit_swdivsf (rtx, rtx, rtx, machine_mode); extern bool loongarch_explicit_relocs_p (enum loongarch_symbol_type); extern bool loongarch_symbol_extreme_p (enum loongarch_symbol_type); extern bool loongarch_option_valid_attribute_p (tree, tree, tree, int); -extern void loongarch_option_override_internal (struct loongarch_target *, struct gcc_options *, struct gcc_options *); +extern void loongarch_option_override_internal (struct loongarch_target *, + struct gcc_options *, struct gcc_options *); extern void loongarch_reset_previous_fndecl (void); extern void loongarch_save_restore_target_globals (tree new_tree); extern void loongarch_register_pragmas (void); diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc index 5c2a9ebbe20c..f7ce3aa2999a 100644 --- a/gcc/config/loongarch/loongarch.cc +++ b/gcc/config/loongarch/loongarch.cc @@ -1718,14 +1718,36 @@ loongarch_symbol_binds_local_p (const_rtx x) bool loongarch_const_vector_bitimm_set_p (rtx op, machine_mode mode) { - if (GET_CODE (op) == CONST_VECTOR && op != CONST0_RTX (mode)) + if (GET_CODE (op) == CONST_VECTOR + && (GET_MODE_CLASS (mode) == MODE_VECTOR_FLOAT + || GET_MODE_CLASS (mode) == MODE_VECTOR_INT)) { - unsigned HOST_WIDE_INT val = UINTVAL (CONST_VECTOR_ELT (op, 0)); + unsigned HOST_WIDE_INT val; + + if (GET_MODE_CLASS (mode) == MODE_VECTOR_FLOAT) + { + rtx val_s = CONST_VECTOR_ELT (op, 0); + const REAL_VALUE_TYPE *x = CONST_DOUBLE_REAL_VALUE (val_s); + if (GET_MODE (val_s) == DFmode) + { + long tmp[2]; + REAL_VALUE_TO_TARGET_DOUBLE (*x, tmp); + val = (unsigned HOST_WIDE_INT) tmp[1] << 32 | tmp[0]; + } + else + { + long tmp; + REAL_VALUE_TO_TARGET_SINGLE (*x, tmp); + val = (unsigned HOST_WIDE_INT) tmp; + } + } + else + val = UINTVAL (CONST_VECTOR_ELT (op, 0)); + int vlog2 = exact_log2 (val & GET_MODE_MASK (GET_MODE_INNER (mode))); if (vlog2 != -1) { - gcc_assert (GET_MODE_CLASS (mode) == MODE_VECTOR_INT); gcc_assert (vlog2 >= 0 && vlog2 <= GET_MODE_UNIT_BITSIZE (mode) - 1); return loongarch_const_vector_same_val_p (op, mode); } @@ -1740,14 +1762,35 @@ loongarch_const_vector_bitimm_set_p (rtx op, machine_mode mode) bool loongarch_const_vector_bitimm_clr_p (rtx op, machine_mode mode) { - if (GET_CODE (op) == CONST_VECTOR && op != CONSTM1_RTX (mode)) + if (GET_CODE (op) == CONST_VECTOR + && (GET_MODE_CLASS (mode) == MODE_VECTOR_FLOAT + || GET_MODE_CLASS (mode) == MODE_VECTOR_INT)) { - unsigned HOST_WIDE_INT val = ~UINTVAL (CONST_VECTOR_ELT (op, 0)); + unsigned HOST_WIDE_INT val; + if (GET_MODE_CLASS (mode) == MODE_VECTOR_FLOAT) + { + rtx val_s = CONST_VECTOR_ELT (op, 0); + const REAL_VALUE_TYPE *x = CONST_DOUBLE_REAL_VALUE (val_s); + if (GET_MODE (val_s) == DFmode) + { + long tmp[2]; + REAL_VALUE_TO_TARGET_DOUBLE (*x, tmp); + val = ~((unsigned HOST_WIDE_INT) tmp[1] << 32 | tmp[0]); + } + else + { + long tmp; + REAL_VALUE_TO_TARGET_SINGLE (*x, tmp); + val = ~((unsigned HOST_WIDE_INT) tmp); + } + } + else + val = ~UINTVAL (CONST_VECTOR_ELT (op, 0)); + int vlog2 = exact_log2 (val & GET_MODE_MASK (GET_MODE_INNER (mode))); if (vlog2 != -1) { - gcc_assert (GET_MODE_CLASS (mode) == MODE_VECTOR_INT); gcc_assert (vlog2 >= 0 && vlog2 <= GET_MODE_UNIT_BITSIZE (mode) - 1); return loongarch_const_vector_same_val_p (op, mode); } @@ -5490,12 +5533,32 @@ loongarch_expand_conditional_move (rtx *operands) } } + auto is_binary_op_0_keep_orig = [](enum rtx_code code) + { + switch (code) + { + case PLUS: + case MINUS: + case IOR: + case XOR: + case ROTATE: + case ROTATERT: + case ASHIFT: + case ASHIFTRT: + case LSHIFTRT: + return true; + default: + return false; + } + }; + /* Check if the optimization conditions are met. */ if (value_if_true_insn && value_if_false_insn - /* Make sure that value_if_false and var are the same. */ - && BINARY_P (value_if_true_insn_src - = SET_SRC (single_set (value_if_true_insn))) + /* Make sure that the orig value OP 0 keep orig. */ + && (value_if_true_insn_src + = SET_SRC (single_set (value_if_true_insn))) + && is_binary_op_0_keep_orig ( GET_CODE (value_if_true_insn_src)) /* Make sure that both value_if_true and value_if_false has the same var. */ && rtx_equal_p (XEXP (value_if_true_insn_src, 0), @@ -6450,7 +6513,28 @@ loongarch_print_operand (FILE *file, rtx op, int letter) if (CONST_VECTOR_P (op)) { machine_mode mode = GET_MODE_INNER (GET_MODE (op)); - unsigned HOST_WIDE_INT val = UINTVAL (CONST_VECTOR_ELT (op, 0)); + rtx val_s = CONST_VECTOR_ELT (op, 0); + unsigned HOST_WIDE_INT val; + + if (GET_MODE_CLASS (mode) == MODE_FLOAT) + { + const REAL_VALUE_TYPE *x = CONST_DOUBLE_REAL_VALUE (val_s); + if (GET_MODE (val_s) == DFmode) + { + long tmp[2]; + REAL_VALUE_TO_TARGET_DOUBLE (*x, tmp); + val = (unsigned HOST_WIDE_INT) (tmp[1] << 32 | tmp[0]); + } + else + { + long tmp; + REAL_VALUE_TO_TARGET_SINGLE (*x, tmp); + val = (unsigned HOST_WIDE_INT) tmp; + } + } + else + val = UINTVAL (val_s); + int vlog2 = exact_log2 (val & GET_MODE_MASK (mode)); if (vlog2 != -1) fprintf (file, "%d", vlog2); @@ -8819,105 +8903,22 @@ loongarch_expand_vec_interleave (rtx target, rtx op0, rtx op1, bool high_p) void loongarch_expand_vec_widen_hilo (rtx dest, rtx op1, rtx op2, - bool uns_p, bool high_p, const char *optab) + bool high_p, rtx (*fn_even) (rtx, rtx, rtx), + rtx (*fn_odd) (rtx, rtx, rtx)) { machine_mode wmode = GET_MODE (dest); machine_mode mode = GET_MODE (op1); - rtx t1, t2, t3; - - t1 = gen_reg_rtx (wmode); - t2 = gen_reg_rtx (wmode); - t3 = gen_reg_rtx (wmode); - switch (mode) - { - case V16HImode: - if (!strcmp (optab, "add")) - { - if (!uns_p) - { - emit_insn (gen_lasx_xvaddwev_w_h (t1, op1, op2)); - emit_insn (gen_lasx_xvaddwod_w_h (t2, op1, op2)); - } - else - { - emit_insn (gen_lasx_xvaddwev_w_hu (t1, op1, op2)); - emit_insn (gen_lasx_xvaddwod_w_hu (t2, op1, op2)); - } - } - else if (!strcmp (optab, "mult")) - { - if (!uns_p) - { - emit_insn (gen_lasx_xvmulwev_w_h (t1, op1, op2)); - emit_insn (gen_lasx_xvmulwod_w_h (t2, op1, op2)); - } - else - { - emit_insn (gen_lasx_xvmulwev_w_hu (t1, op1, op2)); - emit_insn (gen_lasx_xvmulwod_w_hu (t2, op1, op2)); - } - } - else if (!strcmp (optab, "sub")) - { - if (!uns_p) - { - emit_insn (gen_lasx_xvsubwev_w_h (t1, op1, op2)); - emit_insn (gen_lasx_xvsubwod_w_h (t2, op1, op2)); - } - else - { - emit_insn (gen_lasx_xvsubwev_w_hu (t1, op1, op2)); - emit_insn (gen_lasx_xvsubwod_w_hu (t2, op1, op2)); - } - } - break; - case V32QImode: - if (!strcmp (optab, "add")) - { - if (!uns_p) - { - emit_insn (gen_lasx_xvaddwev_h_b (t1, op1, op2)); - emit_insn (gen_lasx_xvaddwod_h_b (t2, op1, op2)); - } - else - { - emit_insn (gen_lasx_xvaddwev_h_bu (t1, op1, op2)); - emit_insn (gen_lasx_xvaddwod_h_bu (t2, op1, op2)); - } - } - else if (!strcmp (optab, "mult")) - { - if (!uns_p) - { - emit_insn (gen_lasx_xvmulwev_h_b (t1, op1, op2)); - emit_insn (gen_lasx_xvmulwod_h_b (t2, op1, op2)); - } - else - { - emit_insn (gen_lasx_xvmulwev_h_bu (t1, op1, op2)); - emit_insn (gen_lasx_xvmulwod_h_bu (t2, op1, op2)); - } - } - else if (!strcmp (optab, "sub")) - { - if (!uns_p) - { - emit_insn (gen_lasx_xvsubwev_h_b (t1, op1, op2)); - emit_insn (gen_lasx_xvsubwod_h_b (t2, op1, op2)); - } - else - { - emit_insn (gen_lasx_xvsubwev_h_bu (t1, op1, op2)); - emit_insn (gen_lasx_xvsubwod_h_bu (t2, op1, op2)); - } - } - break; + gcc_assert (ISA_HAS_LASX + && GET_MODE_SIZE (mode) == 32 + && mode != V4DImode); - default: - gcc_unreachable (); - } + rtx t1 = gen_reg_rtx (wmode); + rtx t2 = gen_reg_rtx (wmode); + rtx t3 = gen_reg_rtx (wmode); + emit_insn (fn_even (t1, op1, op2)); + emit_insn (fn_odd (t2, op1, op2)); loongarch_expand_vec_interleave (t3, t1, t2, high_p); emit_move_insn (dest, gen_lowpart (wmode, t3)); } diff --git a/gcc/config/loongarch/loongarch.md b/gcc/config/loongarch/loongarch.md index be9a2351dd6e..625f30ca2658 100644 --- a/gcc/config/loongarch/loongarch.md +++ b/gcc/config/loongarch/loongarch.md @@ -679,14 +679,22 @@ ;; .................... ;; -(define_insn "trap" - [(trap_if (const_int 1) (const_int 0))] +(define_insn "*trap" + [(trap_if (const_int 1) (match_operand 0 "const_int_operand"))] "" { - return "break\t0"; + return (const_uimm15_operand (operands[0], VOIDmode) + ? "break\t%0" + : "amswap.w\t$r0,$r1,$r0"); } [(set_attr "type" "trap")]) +(define_expand "trap" + [(trap_if (const_int 1) (match_dup 0))] + "" +{ + operands[0] = GEN_INT (la_break_code); +}) ;; diff --git a/gcc/config/loongarch/loongarch.opt b/gcc/config/loongarch/loongarch.opt index fbe61c0bf7c2..628eabe8d591 100644 --- a/gcc/config/loongarch/loongarch.opt +++ b/gcc/config/loongarch/loongarch.opt @@ -213,6 +213,10 @@ mmax-inline-memcpy-size= Target Joined RejectNegative UInteger Var(la_max_inline_memcpy_size) Init(1024) Save -mmax-inline-memcpy-size=SIZE Set the max size of memcpy to inline, default is 1024. +mbreak-code= +Target Joined UInteger Var(la_break_code) Init(-1) Save +-mbreak-code=CODE Use 'break CODE' for traps supposed to be unrecoverable, or an 'amswap.w' instruction leading to INE if CODE is out of range. + Enum Name(explicit_relocs) Type(int) The code model option names for -mexplicit-relocs: diff --git a/gcc/config/loongarch/loongarch.opt.urls b/gcc/config/loongarch/loongarch.opt.urls index 606a211f3223..c93f04683e1c 100644 --- a/gcc/config/loongarch/loongarch.opt.urls +++ b/gcc/config/loongarch/loongarch.opt.urls @@ -48,6 +48,9 @@ UrlSuffix(gcc/LoongArch-Options.html#index-mstrict-align-1) mmax-inline-memcpy-size= UrlSuffix(gcc/LoongArch-Options.html#index-mmax-inline-memcpy-size) +mbreak-code= +UrlSuffix(gcc/LoongArch-Options.html#index-mbreak-code) + mexplicit-relocs= UrlSuffix(gcc/LoongArch-Options.html#index-mexplicit-relocs-1) diff --git a/gcc/config/loongarch/lsx.md b/gcc/config/loongarch/lsx.md index fb0236ba0f1b..cd87757827d6 100644 --- a/gcc/config/loongarch/lsx.md +++ b/gcc/config/loongarch/lsx.md @@ -145,9 +145,6 @@ ;; Only integer modes equal or larger than a word. (define_mode_iterator ILSX_DW [V2DI V4SI]) -;; Only integer modes smaller than a word. -(define_mode_iterator ILSX_HB [V8HI V16QI]) - ;;;; Only integer modes for fixed-point madd_q/maddr_q. ;;(define_mode_iterator ILSX_WH [V4SI V8HI]) @@ -654,59 +651,6 @@ [(set_attr "type" "simd_div") (set_attr "mode" "")]) -(define_insn "xor3" - [(set (match_operand:LSX 0 "register_operand" "=f,f,f") - (xor:LSX - (match_operand:LSX 1 "register_operand" "f,f,f") - (match_operand:LSX 2 "reg_or_vector_same_val_operand" "f,YC,Urv8")))] - "ISA_HAS_LSX" - "@ - vxor.v\t%w0,%w1,%w2 - vbitrevi.%v0\t%w0,%w1,%V2 - vxori.b\t%w0,%w1,%B2" - [(set_attr "type" "simd_logic,simd_bit,simd_logic") - (set_attr "mode" "")]) - -(define_insn "ior3" - [(set (match_operand:LSX 0 "register_operand" "=f,f,f") - (ior:LSX - (match_operand:LSX 1 "register_operand" "f,f,f") - (match_operand:LSX 2 "reg_or_vector_same_val_operand" "f,YC,Urv8")))] - "ISA_HAS_LSX" - "@ - vor.v\t%w0,%w1,%w2 - vbitseti.%v0\t%w0,%w1,%V2 - vori.b\t%w0,%w1,%B2" - [(set_attr "type" "simd_logic,simd_bit,simd_logic") - (set_attr "mode" "")]) - -(define_insn "and3" - [(set (match_operand:LSX 0 "register_operand" "=f,f,f") - (and:LSX - (match_operand:LSX 1 "register_operand" "f,f,f") - (match_operand:LSX 2 "reg_or_vector_same_val_operand" "f,YZ,Urv8")))] - "ISA_HAS_LSX" -{ - switch (which_alternative) - { - case 0: - return "vand.v\t%w0,%w1,%w2"; - case 1: - { - rtx elt0 = CONST_VECTOR_ELT (operands[2], 0); - unsigned HOST_WIDE_INT val = ~UINTVAL (elt0); - operands[2] = loongarch_gen_const_int_vector (mode, val & (-val)); - return "vbitclri.%v0\t%w0,%w1,%V2"; - } - case 2: - return "vandi.b\t%w0,%w1,%B2"; - default: - gcc_unreachable (); - } -} - [(set_attr "type" "simd_logic,simd_bit,simd_logic") - (set_attr "mode" "")]) - (define_insn "one_cmpl2" [(set (match_operand:ILSX 0 "register_operand" "=f") (not:ILSX (match_operand:ILSX 1 "register_operand" "f")))] @@ -852,16 +796,6 @@ [(set_attr "type" "simd_fmadd") (set_attr "mode" "")]) -(define_insn "fnma4" - [(set (match_operand:FLSX 0 "register_operand" "=f") - (fma:FLSX (neg:FLSX (match_operand:FLSX 1 "register_operand" "f")) - (match_operand:FLSX 2 "register_operand" "f") - (match_operand:FLSX 3 "register_operand" "0")))] - "ISA_HAS_LSX" - "vfnmsub.\t%w0,%w1,%w2,%w0" - [(set_attr "type" "simd_fmadd") - (set_attr "mode" "")]) - (define_expand "sqrt2" [(set (match_operand:FLSX 0 "register_operand") (sqrt:FLSX (match_operand:FLSX 1 "register_operand")))] @@ -3220,3 +3154,48 @@ [(set (match_dup 0) (vec_duplicate:V2DI (match_dup 1)))] "") + +(define_expand "vec_widen___" + [(match_operand: 0 "register_operand") + (match_operand:ILSX_WHB 1 "register_operand") + (match_operand:ILSX_WHB 2 "register_operand") + (any_extend (const_int 0)) + (addsub (const_int 0) (const_int 0)) + (const_int zero_one)] + "ISA_HAS_LSX" +{ + rtx t_even = gen_reg_rtx (mode); + rtx t_odd = gen_reg_rtx (mode); + emit_insn (gen_lsx_vwev__ (t_even, operands[1], + operands[2])); + emit_insn (gen_lsx_vwod__ (t_odd, operands[1], + operands[2])); + if () + emit_insn (gen_lsx_vilvh_ (operands[0], t_even, t_odd)); + else + emit_insn (gen_lsx_vilvl_ (operands[0], t_even, t_odd)); + + DONE; +}) + +(define_expand "vec_widen_mult__" + [(match_operand: 0 "register_operand") + (match_operand:ILSX_WHB 1 "register_operand") + (match_operand:ILSX_WHB 2 "register_operand") + (any_extend (const_int 0)) + (const_int zero_one)] + "ISA_HAS_LSX" +{ + rtx t_even = gen_reg_rtx (mode); + rtx t_odd = gen_reg_rtx (mode); + emit_insn (gen_lsx_vmulwev__ (t_even, operands[1], + operands[2])); + emit_insn (gen_lsx_vmulwod__ (t_odd, operands[1], + operands[2])); + if () + emit_insn (gen_lsx_vilvh_ (operands[0], t_even, t_odd)); + else + emit_insn (gen_lsx_vilvl_ (operands[0], t_even, t_odd)); + + DONE; +}) diff --git a/gcc/config/loongarch/simd.md b/gcc/config/loongarch/simd.md index 4156b269f9ad..b73f65aca13a 100644 --- a/gcc/config/loongarch/simd.md +++ b/gcc/config/loongarch/simd.md @@ -23,6 +23,10 @@ ;; Integer modes supported by LASX. (define_mode_iterator ILASX [V4DI V8SI V16HI V32QI]) +;; Only integer modes smaller than a word. +(define_mode_iterator ILSX_HB [V8HI V16QI]) +(define_mode_iterator ILASX_HB [V16HI V32QI]) + ;; FP modes supported by LSX (define_mode_iterator FLSX [V2DF V4SF]) @@ -38,6 +42,10 @@ ;; All integer modes available (define_mode_iterator IVEC [(ILSX "ISA_HAS_LSX") (ILASX "ISA_HAS_LASX")]) +;; All integer modes smaller than a word. +(define_mode_iterator IVEC_HB [(ILSX_HB "ISA_HAS_LSX") + (ILASX_HB "ISA_HAS_LASX")]) + ;; All FP modes available (define_mode_iterator FVEC [(FLSX "ISA_HAS_LSX") (FLASX "ISA_HAS_LASX")]) @@ -90,12 +98,18 @@ (V8HI "V4SI") (V16HI "V8SI") (V16QI "V8HI") (V32QI "V16HI")]) +(define_mode_attr WVEC_QUARTER [(V8HI "V2DI") (V16HI "V4DI") + (V16QI "V4SI") (V32QI "V8SI")]) + ;; Lower-case version. (define_mode_attr wvec_half [(V2DI "v1ti") (V4DI "v2ti") (V4SI "v2di") (V8SI "v4di") (V8HI "v4si") (V16HI "v8si") (V16QI "v8hi") (V32QI "v16hi")]) +(define_mode_attr wvec_quarter [(V8HI "v2di") (V16HI "v4di") + (V16QI "v4si") (V32QI "v8si")]) + ;; Integer vector modes with the same length and unit size as a mode. (define_mode_attr VIMODE [(V2DI "V2DI") (V4SI "V4SI") (V8HI "V8HI") (V16QI "V16QI") @@ -124,12 +138,16 @@ (V8HI "h") (V16HI "h") (V16QI "b") (V32QI "b")]) -;; Suffix for widening LSX or LASX instructions. +;; Suffix for double widening LSX or LASX instructions. (define_mode_attr simdfmt_w [(V2DI "q") (V4DI "q") (V4SI "d") (V8SI "d") (V8HI "w") (V16HI "w") (V16QI "h") (V32QI "h")]) +;; Suffix for quadruple widening LSX or LASX instructions. +(define_mode_attr simdfmt_qw [(V8HI "d") (V16HI "d") + (V16QI "w") (V32QI "w")]) + ;; Suffix for integer mode in LSX or LASX instructions with FP input but ;; integer output. (define_mode_attr simdifmt_for_f [(V2DF "l") (V4DF "l") @@ -169,6 +187,8 @@ (V4SI "uimm5") (V8SI "uimm5") (V2DI "uimm6") (V4DI "uimm6")]) +(define_int_attr hi_lo [(0 "lo") (1 "hi")]) + ;; ======================================================================= ;; For many LASX instructions, the only difference of it from the LSX ;; counterpart is the length of vector operands. Describe these LSX/LASX @@ -431,6 +451,17 @@ [(set_attr "type" "simd_int_arith") (set_attr "mode" "")]) +;; vfnmsub.{s/d} +(define_insn "fnma4" + [(set (match_operand:FVEC 0 "register_operand" "=f") + (fma:FVEC (neg:FVEC (match_operand:FVEC 1 "register_operand" "f")) + (match_operand:FVEC 2 "register_operand" "f") + (match_operand:FVEC 3 "register_operand" "f")))] + "!HONOR_SIGNED_ZEROS (mode)" + "vfnmsub.\t%0,%1,%2,%3" + [(set_attr "type" "simd_fmadd") + (set_attr "mode" "")]) + ;; vfcmp.*.{s/d} with defined RTX code ;; There are no fcmp.{sugt/suge/cgt/cge}.{s/d} menmonics in GAS, so we have ;; to reverse the operands ourselves :(. @@ -826,6 +857,39 @@ DONE; }) +(define_expand "dot_prod" + [(match_operand: 0 "register_operand" "=f,f") + (match_operand:IVEC_HB 1 "register_operand" "f,f") + (match_operand:IVEC_HB 2 "register_operand" "f,f") + (match_operand: 3 "reg_or_0_operand" "f, YG") + (any_extend (const_int 0))] + "" +{ + rtx *op = operands; + rtx res_mulev = gen_reg_rtx (mode); + rtx res_mulod = gen_reg_rtx (mode); + rtx res_addev = gen_reg_rtx (mode); + rtx res_addod = gen_reg_rtx (mode); + emit_insn (gen__vmulwev__ + (res_mulev, op[1], op[2])); + emit_insn (gen__vmulwod__ + (res_mulod, op[1], op[2])); + emit_insn (gen__vhaddw__ + (res_addev, res_mulev, res_mulev)); + emit_insn (gen__vhaddw__ + (res_addod, res_mulod, res_mulod)); + if (op[3] == CONST0_RTX (mode)) + emit_insn (gen_add3 (op[0], res_addev, + res_addod)); + else + { + emit_insn (gen_add3 (res_addev, res_addev, + res_addod)); + emit_insn (gen_add3 (op[0], res_addev, op[3])); + } + DONE; +}) + (define_insn "simd_maddw_evod__hetero" [(set (match_operand: 0 "register_operand" "=f") (plus: @@ -972,6 +1036,77 @@ DONE; }) +(define_insn "xor3" + [(set (match_operand:ALLVEC 0 "register_operand" "=f,f,f") + (xor:ALLVEC + (match_operand:ALLVEC 1 "register_operand" "f,f,f") + (match_operand:ALLVEC 2 "reg_or_vector_same_val_operand" "f,YC,Urv8")))] + "" + "@ + vxor.v\t%0,%1,%2 + vbitrevi.%v0\t%0,%1,%V2 + vxori.b\t%0,%1,%B2" + [(set_attr "type" "simd_logic,simd_bit,simd_logic") + (set_attr "mode" "")]) + +(define_insn "ior3" + [(set (match_operand:ALLVEC 0 "register_operand" "=f,f,f") + (ior:ALLVEC + (match_operand:ALLVEC 1 "register_operand" "f,f,f") + (match_operand:ALLVEC 2 "reg_or_vector_same_val_operand" "f,YC,Urv8")))] + "" + "@ + vor.v\t%0,%1,%2 + vbitseti.%v0\t%0,%1,%V2 + vori.b\t%0,%1,%B2" + [(set_attr "type" "simd_logic,simd_bit,simd_logic") + (set_attr "mode" "")]) + +(define_insn "and3" + [(set (match_operand:ALLVEC 0 "register_operand" "=f,f,f") + (and:ALLVEC + (match_operand:ALLVEC 1 "register_operand" "f,f,f") + (match_operand:ALLVEC 2 "reg_or_vector_same_val_operand" "f,YZ,Urv8")))] + "" +{ + switch (which_alternative) + { + case 0: + return "vand.v\t%0,%1,%2"; + case 1: + { + rtx elt0 = CONST_VECTOR_ELT (operands[2], 0); + unsigned HOST_WIDE_INT val; + if (GET_MODE_CLASS (mode) == MODE_VECTOR_FLOAT) + { + const REAL_VALUE_TYPE *x = CONST_DOUBLE_REAL_VALUE (elt0); + if (GET_MODE (elt0) == DFmode) + { + long tmp[2]; + REAL_VALUE_TO_TARGET_DOUBLE (*x, tmp); + val = ~((unsigned HOST_WIDE_INT) tmp[1] << 32 | tmp[0]); + } + else + { + long tmp; + REAL_VALUE_TO_TARGET_SINGLE (*x, tmp); + val = ~((unsigned HOST_WIDE_INT) tmp); + } + } + else + val = ~UINTVAL (elt0); + operands[2] = loongarch_gen_const_int_vector (mode, val & (-val)); + return "vbitclri.%v0\t%0,%1,%V2"; + } + case 2: + return "vandi.b\t%0,%1,%B2"; + default: + gcc_unreachable (); + } +} + [(set_attr "type" "simd_logic,simd_bit,simd_logic") + (set_attr "mode" "")]) + ; The LoongArch SX Instructions. (include "lsx.md") diff --git a/gcc/config/riscv/riscv-avlprop.cc b/gcc/config/riscv/riscv-avlprop.cc index b8547a722c5e..a42764ec9ca0 100644 --- a/gcc/config/riscv/riscv-avlprop.cc +++ b/gcc/config/riscv/riscv-avlprop.cc @@ -77,6 +77,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-pass.h" #include "df.h" #include "rtl-ssa.h" +#include "rtl-iter.h" #include "cfgcleanup.h" #include "insn-attr.h" #include "tm-constrs.h" @@ -412,6 +413,46 @@ pass_avlprop::get_vlmax_ta_preferred_avl (insn_info *insn) const && def1->insn ()->compare_with (insn) >= 0) return NULL_RTX; } + else + { + /* If the use is in a subreg e.g. in a store it is possible that + we punned the vector mode with a larger mode like + (subreg:V1SI (reg:V4QI 123)). + For an AVL of 1 that means we actually store one SImode + element and not 1 QImode elements. But the latter is what we + would propagate if we took the AVL operand literally. + Instead we scale it by the ratio of inner and outer mode + (4 in the example above). */ + int factor = 1; + if (use->includes_subregs ()) + { + subrtx_iterator::array_type array; + FOR_EACH_SUBRTX (iter, array, use_insn->rtl (), NONCONST) + { + const_rtx x = *iter; + if (x + && SUBREG_P (x) + && REG_P (SUBREG_REG (x)) + && REGNO (SUBREG_REG (x)) == use->regno () + && known_eq (GET_MODE_SIZE (use->mode ()), + GET_MODE_SIZE (GET_MODE (x)))) + { + if (can_div_trunc_p (GET_MODE_NUNITS (use->mode ()), + GET_MODE_NUNITS (GET_MODE (x)), + &factor)) + { + gcc_assert (factor > 0); + break; + } + else + return NULL_RTX; + } + } + } + + if (factor > 1) + new_use_avl = GEN_INT (INTVAL (new_use_avl) * factor); + } if (!use_avl) use_avl = new_use_avl; diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc index 74701b735082..63404d3d5143 100644 --- a/gcc/config/riscv/riscv.cc +++ b/gcc/config/riscv/riscv.cc @@ -7101,13 +7101,13 @@ riscv_get_vls_cc_attr (const_tree args, bool check_only = false) abi_vlen = TREE_INT_CST_LOW (vlen_arg); } - if (!riscv_valid_abi_vlen_vls_cc_p (abi_vlen)) + if (!riscv_valid_abi_vlen_vls_cc_p (abi_vlen) && !check_only) { error_at (input_location, - "unsupported ABI_VLEN value %d for %qs attribute;" - "ABI_VLEN must be in the range [32, 16384] and must be " - "a power of 2.", - "riscv_vls_cc", abi_vlen); + "unsupported % value %d for %qs attribute;" + "% be in the range [32, 16384] and must be " + "a power of 2", + abi_vlen, "riscv_vls_cc"); return RISCV_CC_UNKNOWN; } @@ -7258,7 +7258,7 @@ riscv_handle_type_attribute (tree *node ATTRIBUTE_UNUSED, tree name, tree args, } static tree -riscv_handle_rvv_vls_cc_attribute (tree *node, tree name, tree args, +riscv_handle_rvv_vls_cc_attribute (tree *, tree name, tree args, ATTRIBUTE_UNUSED int flags, bool *no_add_attrs) { diff --git a/gcc/coretypes.h b/gcc/coretypes.h index 8c3633b96771..779abb9b05ea 100644 --- a/gcc/coretypes.h +++ b/gcc/coretypes.h @@ -147,12 +147,14 @@ using dw_cfi_ref = struct dw_cfi_node *; enum dw_cfi_oprnd_type: int; enum dwarf_call_frame_info: int; -/* Subclasses of symtab_node, using indentation to show the class +/* Subclasses of toplevel_node, using indentation to show the class hierarchy. */ -struct symtab_node; - struct cgraph_node; - struct varpool_node; +struct toplevel_node; + struct asm_node; + struct symtab_node; + struct cgraph_node; + struct varpool_node; struct cgraph_edge; union section; diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 75cd6fec9ac4..73c2a0374480 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,35 @@ +2025-10-30 Jakub Jelinek + + * std-name-hint.gperf: Remove duplicate entries for ispanstream + and istringstream. + * std-name-hint.h: Regenerate. + +2025-10-28 Marek Polacek + Jakub Jelinek + + * decl.cc (finish_enum_value_list): Use fold_convert instead of + copy_node. + +2025-10-27 Nathaniel Shead + + PR c++/122422 + * decl.cc (maybe_deduce_size_from_array_init): Propagate type to + corresponding TEMPLATE_DECL. + +2025-10-27 Nathaniel Shead + + PR c++/122310 + * module.cc (get_keyed_decl_scope): New function. + (trees_out::get_merge_kind): Use it. + (trees_out::key_mergeable): Use it. + (maybe_key_decl): Key to the containing type for all members. + +2025-10-27 Paul-Antoine Arras + + PR c++/122378 + * parser.cc (cp_parser_label_declaration): Mangle label declaration in a + metadirective region. + 2025-10-21 Jakub Jelinek * cp-tree.h: Implement C++23 P2674R1 - A trait for implicit lifetime diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc index 2089e4c21acc..751ba40fc7f0 100644 --- a/gcc/cp/decl.cc +++ b/gcc/cp/decl.cc @@ -7096,6 +7096,14 @@ maybe_deduce_size_from_array_init (tree decl, tree init) cp_apply_type_quals_to_decl (cp_type_quals (TREE_TYPE (decl)), decl); relayout_decl (decl); + + /* Update the type of the corresponding TEMPLATE_DECL to match. */ + if (DECL_LANG_SPECIFIC (decl) && DECL_TEMPLATE_INFO (decl)) + { + tree tmpl = template_for_substitution (decl); + if (DECL_TEMPLATE_RESULT (tmpl) == decl) + TREE_TYPE (tmpl) = TREE_TYPE (decl); + } } } @@ -18950,13 +18958,9 @@ finish_enum_value_list (tree enumtype) value = perform_implicit_conversion (underlying_type, DECL_INITIAL (decl), tf_warning_or_error); - /* Do not clobber shared ints. */ - if (value != error_mark_node) - { - value = copy_node (value); + /* Do not clobber shared ints. But do share identical enumerators. */ + value = fold_convert (enumtype, value); - TREE_TYPE (value) = enumtype; - } DECL_INITIAL (decl) = value; if (export_p) DECL_MODULE_EXPORT_P (decl) = true; diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index ed0d69cead45..81357a86cfe8 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -2798,6 +2798,8 @@ vec *post_load_decls; typedef hash_map> keyed_map_t; static keyed_map_t *keyed_table; +static tree get_keyed_decl_scope (tree); + /* Instantiations of temploid friends imported from another module need to be attached to the same module as the temploid. This maps these decls to the temploid they are instantiated from, as there is @@ -11464,20 +11466,12 @@ trees_out::get_merge_kind (tree decl, depset *dep) if (DECL_IMPLICIT_TYPEDEF_P (STRIP_TEMPLATE (decl)) && LAMBDA_TYPE_P (TREE_TYPE (decl))) { - if (tree scope = LAMBDA_TYPE_EXTRA_SCOPE (TREE_TYPE (decl))) - { - /* Lambdas attached to fields are keyed to its class. */ - if (TREE_CODE (scope) == FIELD_DECL) - scope = TYPE_NAME (DECL_CONTEXT (scope)); - if (DECL_LANG_SPECIFIC (scope) - && DECL_MODULE_KEYED_DECLS_P (scope)) - { - mk = MK_keyed; - break; - } - } - /* Lambdas not attached to any mangling scope are TU-local. */ - mk = MK_unique; + if (get_keyed_decl_scope (decl)) + mk = MK_keyed; + else + /* Lambdas not attached to any mangling scope are TU-local + and so cannot be deduplicated. */ + mk = MK_unique; break; } @@ -11778,16 +11772,9 @@ trees_out::key_mergeable (int tag, merge_kind mk, tree decl, tree inner, case MK_keyed: { - gcc_checking_assert (LAMBDA_TYPE_P (TREE_TYPE (inner))); - tree scope = LAMBDA_TYPE_EXTRA_SCOPE (TREE_TYPE (inner)); - gcc_checking_assert (TREE_CODE (scope) == VAR_DECL - || TREE_CODE (scope) == FIELD_DECL - || TREE_CODE (scope) == PARM_DECL - || TREE_CODE (scope) == TYPE_DECL - || TREE_CODE (scope) == CONCEPT_DECL); - /* Lambdas attached to fields are keyed to the class. */ - if (TREE_CODE (scope) == FIELD_DECL) - scope = TYPE_NAME (DECL_CONTEXT (scope)); + tree scope = get_keyed_decl_scope (inner); + gcc_checking_assert (scope); + auto *root = keyed_table->get (scope); unsigned ix = root->length (); /* If we don't find it, we'll write a really big number @@ -21511,9 +21498,21 @@ maybe_key_decl (tree ctx, tree decl) && TREE_CODE (ctx) != CONCEPT_DECL) return; - /* For fields, key it to the containing type to handle deduplication - correctly. */ - if (TREE_CODE (ctx) == FIELD_DECL) + /* For members, key it to the containing type to handle deduplication + correctly. For fields, this is necessary as FIELD_DECLs have no + dep and so would only be streamed after the lambda type, defeating + our ability to merge them. + + Other class-scope key decls might depend on the type of the lambda + but be within the same cluster; we need to ensure that we never + first see the key decl while streaming the lambda type as merging + would then fail when comparing the partially-streamed lambda type + of the key decl with the existing (PR c++/122310). + + Perhaps sort_cluster can be adjusted to handle this better, but + this is a simple workaround (and might down on the number of + entries in keyed_table as a bonus). */ + while (DECL_CLASS_SCOPE_P (ctx)) ctx = TYPE_NAME (DECL_CONTEXT (ctx)); if (!keyed_table) @@ -21528,6 +21527,30 @@ maybe_key_decl (tree ctx, tree decl) vec.safe_push (decl); } +/* Find the scope that the lambda DECL is keyed to, if any. */ + +static tree +get_keyed_decl_scope (tree decl) +{ + gcc_checking_assert (LAMBDA_TYPE_P (TREE_TYPE (decl))); + tree scope = LAMBDA_TYPE_EXTRA_SCOPE (TREE_TYPE (decl)); + if (!scope) + return NULL_TREE; + + gcc_checking_assert (TREE_CODE (scope) == VAR_DECL + || TREE_CODE (scope) == FIELD_DECL + || TREE_CODE (scope) == PARM_DECL + || TREE_CODE (scope) == TYPE_DECL + || TREE_CODE (scope) == CONCEPT_DECL); + + while (DECL_CLASS_SCOPE_P (scope)) + scope = TYPE_NAME (DECL_CONTEXT (scope)); + + gcc_checking_assert (DECL_LANG_SPECIFIC (scope) + && DECL_MODULE_KEYED_DECLS_P (scope)); + return scope; +} + /* DECL is an instantiated friend that should be attached to the same module that ORIG is. */ diff --git a/gcc/cp/std-name-hint.gperf b/gcc/cp/std-name-hint.gperf index 3e06e61501d2..641f3c5e7854 100644 --- a/gcc/cp/std-name-hint.gperf +++ b/gcc/cp/std-name-hint.gperf @@ -420,7 +420,6 @@ basic_ospanstream, "", cxx23 basic_spanbuf, "", cxx23 basic_spanstream, "", cxx23 ispanstream, "", cxx23 -ispanstream, "", cxx23 ospanstream, "", cxx23 spanbuf, "", cxx23 spanstream, "", cxx23 @@ -433,7 +432,6 @@ basic_ostringstream, "", cxx98 basic_stringbuf, "", cxx98 basic_stringstream, "", cxx98 istringstream, "", cxx98 -istringstream, "", cxx98 ostringstream, "", cxx98 stringbuf, "", cxx98 stringstream, "", cxx98 diff --git a/gcc/cp/std-name-hint.h b/gcc/cp/std-name-hint.h index e354032a229b..8e64b56ebd31 100644 --- a/gcc/cp/std-name-hint.h +++ b/gcc/cp/std-name-hint.h @@ -61,7 +61,7 @@ struct std_name_hint /* The dialect of C++ in which this was added. */ enum cxx_dialect min_dialect; }; -/* maximum key range = 2080, duplicates = 7 */ +/* maximum key range = 2080, duplicates = 5 */ class std_name_hint_lookup { @@ -135,7 +135,7 @@ std_name_hint_lookup::find (const char *str, size_t len) { enum { - TOTAL_KEYWORDS = 488, + TOTAL_KEYWORDS = 486, MIN_WORD_LENGTH = 2, MAX_WORD_LENGTH = 39, MIN_HASH_VALUE = 7, @@ -148,7 +148,7 @@ std_name_hint_lookup::find (const char *str, size_t len) {"regular", "", cxx20}, #line 292 "std-name-hint.gperf" {"reverse_iterator", "", cxx98}, -#line 454 "std-name-hint.gperf" +#line 452 "std-name-hint.gperf" {"range_error", "", cxx98}, #line 408 "std-name-hint.gperf" {"set", "", cxx98}, @@ -164,13 +164,13 @@ std_name_hint_lookup::find (const char *str, size_t len) {"formatter", "", cxx20}, #line 196 "std-name-hint.gperf" {"basic_filebuf", "", cxx98}, -#line 575 "std-name-hint.gperf" +#line 573 "std-name-hint.gperf" {"pair", "", cxx98}, #line 276 "std-name-hint.gperf" {"begin", "", cxx11}, #line 179 "std-name-hint.gperf" {"formattable", "", cxx23}, -#line 541 "std-name-hint.gperf" +#line 539 "std-name-hint.gperf" {"bad_cast", "", cxx98}, #line 233 "std-name-hint.gperf" {"setiosflags", "", cxx98}, @@ -178,7 +178,7 @@ std_name_hint_lookup::find (const char *str, size_t len) {"print", "", cxx23}, #line 221 "std-name-hint.gperf" {"promise", "", cxx11}, -#line 582 "std-name-hint.gperf" +#line 580 "std-name-hint.gperf" {"bad_variant_access", "", cxx17}, #line 328 "std-name-hint.gperf" {"to_address", "", cxx20}, @@ -196,9 +196,9 @@ std_name_hint_lookup::find (const char *str, size_t len) {"nouppercase", "", cxx98}, #line 250 "std-name-hint.gperf" {"nounitbuf", "", cxx98}, -#line 433 "std-name-hint.gperf" +#line 432 "std-name-hint.gperf" {"basic_stringbuf", "", cxx98}, -#line 593 "std-name-hint.gperf" +#line 591 "std-name-hint.gperf" {"vector", "", cxx98}, #line 246 "std-name-hint.gperf" {"noshowbase", "", cxx98}, @@ -210,9 +210,9 @@ std_name_hint_lookup::find (const char *str, size_t len) {"pmr::get_default_resource", "", cxx17}, #line 343 "std-name-hint.gperf" {"pmr::set_default_resource", "", cxx17}, -#line 455 "std-name-hint.gperf" +#line 453 "std-name-hint.gperf" {"runtime_error", "", cxx98}, -#line 516 "std-name-hint.gperf" +#line 514 "std-name-hint.gperf" {"tuple", "", cxx11}, #line 132 "std-name-hint.gperf" {"regular_invocable", "", cxx20}, @@ -224,15 +224,15 @@ std_name_hint_lookup::find (const char *str, size_t len) {"not_fn", "", cxx17}, #line 142 "std-name-hint.gperf" {"byte", "", cxx17}, -#line 518 "std-name-hint.gperf" +#line 516 "std-name-hint.gperf" {"tuple_element", "", cxx11}, -#line 519 "std-name-hint.gperf" +#line 517 "std-name-hint.gperf" {"tuple_element_t", "", cxx14}, -#line 585 "std-name-hint.gperf" +#line 583 "std-name-hint.gperf" {"variant", "", cxx17}, #line 386 "std-name-hint.gperf" {"ends", "", cxx98}, -#line 520 "std-name-hint.gperf" +#line 518 "std-name-hint.gperf" {"tuple_size", "", cxx11}, #line 123 "std-name-hint.gperf" {"equality_comparable", "", cxx20}, @@ -244,37 +244,37 @@ std_name_hint_lookup::find (const char *str, size_t len) {"noshowpos", "", cxx98}, #line 388 "std-name-hint.gperf" {"flush_emit", "", cxx20}, -#line 586 "std-name-hint.gperf" +#line 584 "std-name-hint.gperf" {"variant_alternative", "", cxx17}, -#line 537 "std-name-hint.gperf" +#line 535 "std-name-hint.gperf" {"void_t", "", cxx17}, -#line 587 "std-name-hint.gperf" +#line 585 "std-name-hint.gperf" {"variant_alternative_t", "", cxx17}, #line 134 "std-name-hint.gperf" {"relation", "", cxx20}, -#line 461 "std-name-hint.gperf" - {"float32_t", "", cxx23}, #line 459 "std-name-hint.gperf" + {"float32_t", "", cxx23}, +#line 457 "std-name-hint.gperf" {"float128_t", "", cxx23}, #line 381 "std-name-hint.gperf" {"nullopt", "", cxx17}, #line 291 "std-name-hint.gperf" {"prev", "", cxx11}, -#line 425 "std-name-hint.gperf" +#line 424 "std-name-hint.gperf" {"spanbuf", "", cxx23}, -#line 513 "std-name-hint.gperf" +#line 511 "std-name-hint.gperf" {"make_from_tuple", "", cxx17}, #line 253 "std-name-hint.gperf" {"right", "", cxx98}, #line 210 "std-name-hint.gperf" {"mem_fn", "", cxx11}, -#line 515 "std-name-hint.gperf" +#line 513 "std-name-hint.gperf" {"tie", "", cxx11}, #line 197 "std-name-hint.gperf" {"basic_fstream", "", cxx98}, -#line 573 "std-name-hint.gperf" +#line 571 "std-name-hint.gperf" {"move", "", cxx11}, -#line 462 "std-name-hint.gperf" +#line 460 "std-name-hint.gperf" {"float64_t", "", cxx23}, #line 127 "std-name-hint.gperf" {"movable", "", cxx20}, @@ -282,13 +282,13 @@ std_name_hint_lookup::find (const char *str, size_t len) {"front_inserter", "", cxx98}, #line 296 "std-name-hint.gperf" {"map", "", cxx98}, -#line 460 "std-name-hint.gperf" +#line 458 "std-name-hint.gperf" {"float16_t", "", cxx23}, #line 56 "std-name-hint.gperf" {"bitset", "", cxx11}, #line 205 "std-name-hint.gperf" {"bind_front", "", cxx20}, -#line 574 "std-name-hint.gperf" +#line 572 "std-name-hint.gperf" {"move_if_noexcept", "", cxx11}, #line 274 "std-name-hint.gperf" {"advance", "", cxx98}, @@ -296,7 +296,7 @@ std_name_hint_lookup::find (const char *str, size_t len) {"move_iterator", "", cxx11}, #line 161 "std-name-hint.gperf" {"terminate", "", cxx98}, -#line 531 "std-name-hint.gperf" +#line 529 "std-name-hint.gperf" {"negation", "", cxx17}, #line 318 "std-name-hint.gperf" {"make_obj_using_allocator", "", cxx20}, @@ -310,7 +310,7 @@ std_name_hint_lookup::find (const char *str, size_t len) {"range_formatter", "", cxx23}, #line 299 "std-name-hint.gperf" {"addressof", "", cxx11}, -#line 571 "std-name-hint.gperf" +#line 569 "std-name-hint.gperf" {"make_integer_sequence", "", cxx14}, #line 184 "std-name-hint.gperf" {"range_format", "", cxx23}, @@ -320,25 +320,25 @@ std_name_hint_lookup::find (const char *str, size_t len) {"basic_spanstream", "", cxx23}, #line 257 "std-name-hint.gperf" {"showpos", "", cxx98}, -#line 550 "std-name-hint.gperf" +#line 548 "std-name-hint.gperf" {"as_const", "", cxx17}, #line 308 "std-name-hint.gperf" {"bad_weak_ptr", "", cxx11}, #line 168 "std-name-hint.gperf" {"basic_format_context", "", cxx20}, -#line 434 "std-name-hint.gperf" +#line 433 "std-name-hint.gperf" {"basic_stringstream", "", cxx98}, -#line 539 "std-name-hint.gperf" +#line 537 "std-name-hint.gperf" {"type_index", "", cxx11}, #line 169 "std-name-hint.gperf" {"basic_format_parse_context", "", cxx20}, #line 160 "std-name-hint.gperf" {"make_exception_ptr", "", cxx11}, -#line 468 "std-name-hint.gperf" +#line 466 "std-name-hint.gperf" {"basic_streambuf", "", cxx98}, #line 167 "std-name-hint.gperf" {"basic_format_args", "", cxx20}, -#line 589 "std-name-hint.gperf" +#line 587 "std-name-hint.gperf" {"variant_size", "", cxx17}, #line 407 "std-name-hint.gperf" {"multiset", "", cxx98}, @@ -350,23 +350,23 @@ std_name_hint_lookup::find (const char *str, size_t len) {"recursive_timed_mutex", "", cxx11}, #line 399 "std-name-hint.gperf" {"ranges::enable_borrowed_range", "", cxx20}, -#line 533 "std-name-hint.gperf" +#line 531 "std-name-hint.gperf" {"remove_cvref", "", cxx20}, #line 206 "std-name-hint.gperf" {"function", "", cxx11}, -#line 532 "std-name-hint.gperf" +#line 530 "std-name-hint.gperf" {"negation_v", "", cxx17}, -#line 534 "std-name-hint.gperf" +#line 532 "std-name-hint.gperf" {"remove_cvref_t", "", cxx20}, #line 289 "std-name-hint.gperf" {"ostream_iterator", "", cxx98}, -#line 588 "std-name-hint.gperf" +#line 586 "std-name-hint.gperf" {"variant_npos", "", cxx17}, #line 244 "std-name-hint.gperf" {"left", "", cxx98}, #line 200 "std-name-hint.gperf" {"fstream", "", cxx98}, -#line 591 "std-name-hint.gperf" +#line 589 "std-name-hint.gperf" {"visit", "", cxx17}, #line 208 "std-name-hint.gperf" {"invoke", "", cxx17}, @@ -388,7 +388,7 @@ std_name_hint_lookup::find (const char *str, size_t len) {"pointer_traits", "", cxx11}, #line 131 "std-name-hint.gperf" {"invocable", "", cxx20}, -#line 426 "std-name-hint.gperf" +#line 425 "std-name-hint.gperf" {"spanstream", "", cxx23}, #line 182 "std-name-hint.gperf" {"make_format_args", "", cxx20}, @@ -400,9 +400,9 @@ std_name_hint_lookup::find (const char *str, size_t len) {"skipws", "", cxx98}, #line 241 "std-name-hint.gperf" {"hex", "", cxx98}, -#line 568 "std-name-hint.gperf" +#line 566 "std-name-hint.gperf" {"index_sequence_for", "", cxx14}, -#line 567 "std-name-hint.gperf" +#line 565 "std-name-hint.gperf" {"index_sequence", "", cxx14}, #line 350 "std-name-hint.gperf" {"mutex", "", cxx11}, @@ -412,7 +412,7 @@ std_name_hint_lookup::find (const char *str, size_t len) {"weak_ptr", "", cxx11}, #line 173 "std-name-hint.gperf" {"format_context", "", cxx20}, -#line 451 "std-name-hint.gperf" +#line 449 "std-name-hint.gperf" {"logic_error", "", cxx98}, #line 372 "std-name-hint.gperf" {"numbers::ln2_v", "", cxx20}, @@ -444,11 +444,11 @@ std_name_hint_lookup::find (const char *str, size_t len) {"pmr::polymorphic_allocator", "", cxx17}, #line 419 "std-name-hint.gperf" {"basic_ospanstream", "", cxx23}, -#line 572 "std-name-hint.gperf" +#line 570 "std-name-hint.gperf" {"make_pair", "", cxx98}, #line 172 "std-name-hint.gperf" {"format_args", "", cxx20}, -#line 475 "std-name-hint.gperf" +#line 473 "std-name-hint.gperf" {"stof", "", cxx11}, #line 339 "std-name-hint.gperf" {"pmr::monotonic_buffer_resource", "", cxx17}, @@ -456,9 +456,9 @@ std_name_hint_lookup::find (const char *str, size_t len) {"pmr::pool_options", "", cxx17}, #line 256 "std-name-hint.gperf" {"showpoint", "", cxx98}, -#line 446 "std-name-hint.gperf" +#line 444 "std-name-hint.gperf" {"stacktrace", "", cxx23}, -#line 590 "std-name-hint.gperf" +#line 588 "std-name-hint.gperf" {"variant_size_v", "", cxx17}, #line 212 "std-name-hint.gperf" {"reference_wrapper", "", cxx11}, @@ -466,19 +466,19 @@ std_name_hint_lookup::find (const char *str, size_t len) {"cerr", "", cxx98}, #line 300 "std-name-hint.gperf" {"align", "", cxx11}, -#line 438 "std-name-hint.gperf" +#line 436 "std-name-hint.gperf" {"stringbuf", "", cxx98}, -#line 469 "std-name-hint.gperf" +#line 467 "std-name-hint.gperf" {"streambuf", "", cxx98}, #line 306 "std-name-hint.gperf" {"allocator_traits", "", cxx11}, #line 183 "std-name-hint.gperf" {"make_wformat_args", "", cxx20}, -#line 584 "std-name-hint.gperf" +#line 582 "std-name-hint.gperf" {"monostate", "", cxx17}, #line 387 "std-name-hint.gperf" {"flush", "", cxx98}, -#line 527 "std-name-hint.gperf" +#line 525 "std-name-hint.gperf" {"enable_if", "", cxx11}, #line 352 "std-name-hint.gperf" {"recursive_mutex", "", cxx11}, @@ -490,15 +490,15 @@ std_name_hint_lookup::find (const char *str, size_t len) {"pmr::memory_resource", "", cxx17}, #line 124 "std-name-hint.gperf" {"equality_comparable_with", "", cxx20}, -#line 493 "std-name-hint.gperf" +#line 491 "std-name-hint.gperf" {"errc", "", cxx11}, #line 344 "std-name-hint.gperf" {"pmr::synchronized_pool_resource", "", cxx17}, #line 385 "std-name-hint.gperf" {"endl", "", cxx98}, -#line 495 "std-name-hint.gperf" +#line 493 "std-name-hint.gperf" {"error_code", "", cxx11}, -#line 528 "std-name-hint.gperf" +#line 526 "std-name-hint.gperf" {"enable_if_t", "", cxx14}, #line 390 "std-name-hint.gperf" {"ostream", "", cxx98}, @@ -508,27 +508,27 @@ std_name_hint_lookup::find (const char *str, size_t len) {"numbers::log10e_v", "", cxx20}, #line 364 "std-name-hint.gperf" {"nothrow_t", "", cxx98}, -#line 512 "std-name-hint.gperf" +#line 510 "std-name-hint.gperf" {"ignore", "", cxx11}, #line 360 "std-name-hint.gperf" {"hardware_constructive_interference_size", "", cxx17}, #line 396 "std-name-hint.gperf" {"priority_queue", "", cxx98}, -#line 424 "std-name-hint.gperf" +#line 423 "std-name-hint.gperf" {"ospanstream", "", cxx23}, #line 316 "std-name-hint.gperf" {"enable_shared_from_this", "", cxx11}, #line 265 "std-name-hint.gperf" {"cout", "", cxx98}, -#line 552 "std-name-hint.gperf" +#line 550 "std-name-hint.gperf" {"cmp_greater", "", cxx20}, -#line 490 "std-name-hint.gperf" +#line 488 "std-name-hint.gperf" {"basic_string_view", "", cxx17}, #line 249 "std-name-hint.gperf" {"noskipws", "", cxx98}, #line 177 "std-name-hint.gperf" {"format_to", "", cxx20}, -#line 502 "std-name-hint.gperf" +#line 500 "std-name-hint.gperf" {"make_error_code", "", cxx11}, #line 174 "std-name-hint.gperf" {"format_error", "", cxx20}, @@ -542,7 +542,7 @@ std_name_hint_lookup::find (const char *str, size_t len) {"hexfloat", "", cxx11}, #line 326 "std-name-hint.gperf" {"shared_ptr", "", cxx11}, -#line 569 "std-name-hint.gperf" +#line 567 "std-name-hint.gperf" {"integer_sequence", "", cxx14}, #line 271 "std-name-hint.gperf" {"istream", "", cxx98}, @@ -552,19 +552,17 @@ std_name_hint_lookup::find (const char *str, size_t len) {"unitbuf", "", cxx98}, #line 294 "std-name-hint.gperf" {"list", "", cxx98}, -#line 554 "std-name-hint.gperf" +#line 552 "std-name-hint.gperf" {"cmp_less", "", cxx20}, #line 422 "std-name-hint.gperf" {"ispanstream", "", cxx23}, -#line 423 "std-name-hint.gperf" - {"ispanstream", "", cxx23}, -#line 470 "std-name-hint.gperf" +#line 468 "std-name-hint.gperf" {"wstreambuf", "", cxx98}, -#line 432 "std-name-hint.gperf" +#line 431 "std-name-hint.gperf" {"basic_ostringstream", "", cxx98}, -#line 503 "std-name-hint.gperf" +#line 501 "std-name-hint.gperf" {"make_error_condition", "", cxx11}, -#line 570 "std-name-hint.gperf" +#line 568 "std-name-hint.gperf" {"make_index_sequence", "", cxx14}, #line 405 "std-name-hint.gperf" {"counting_semaphore", "", cxx20}, @@ -578,17 +576,17 @@ std_name_hint_lookup::find (const char *str, size_t len) {"const_pointer_cast", "", cxx11}, #line 45 "std-name-hint.gperf" {"make_any", "", cxx17}, -#line 465 "std-name-hint.gperf" +#line 463 "std-name-hint.gperf" {"stop_source", "", cxx20}, -#line 548 "std-name-hint.gperf" +#line 546 "std-name-hint.gperf" {"unordered_set", "", cxx11}, -#line 583 "std-name-hint.gperf" +#line 581 "std-name-hint.gperf" {"holds_alternative", "", cxx17}, -#line 514 "std-name-hint.gperf" +#line 512 "std-name-hint.gperf" {"make_tuple", "", cxx11}, #line 47 "std-name-hint.gperf" {"array", "", cxx11}, -#line 517 "std-name-hint.gperf" +#line 515 "std-name-hint.gperf" {"tuple_cat", "", cxx11}, #line 323 "std-name-hint.gperf" {"owner_less", "", cxx11}, @@ -598,15 +596,15 @@ std_name_hint_lookup::find (const char *str, size_t len) {"exception_ptr", "", cxx11}, #line 207 "std-name-hint.gperf" {"hash", "", cxx11}, -#line 521 "std-name-hint.gperf" +#line 519 "std-name-hint.gperf" {"tuple_size_v", "", cxx17}, -#line 431 "std-name-hint.gperf" +#line 430 "std-name-hint.gperf" {"basic_istringstream", "", cxx98}, #line 153 "std-name-hint.gperf" {"uintptr_t", "", cxx11}, -#line 476 "std-name-hint.gperf" +#line 474 "std-name-hint.gperf" {"stoi", "", cxx11}, -#line 466 "std-name-hint.gperf" +#line 464 "std-name-hint.gperf" {"stop_token", "", cxx20}, #line 151 "std-name-hint.gperf" {"uint_least8_t", "", cxx11}, @@ -622,7 +620,7 @@ std_name_hint_lookup::find (const char *str, size_t len) {"shared_mutex", "", cxx17}, #line 375 "std-name-hint.gperf" {"numbers::phi_v", "", cxx20}, -#line 499 "std-name-hint.gperf" +#line 497 "std-name-hint.gperf" {"is_error_code_enum_v", "", cxx17}, #line 155 "std-name-hint.gperf" {"deque", "", cxx98}, @@ -630,7 +628,7 @@ std_name_hint_lookup::find (const char *str, size_t len) {"shared_timed_mutex", "", cxx14}, #line 290 "std-name-hint.gperf" {"ostreambuf_iterator", "", cxx98}, -#line 501 "std-name-hint.gperf" +#line 499 "std-name-hint.gperf" {"is_error_condition_enum_v", "", cxx17}, #line 148 "std-name-hint.gperf" {"uint_least16_t", "", cxx11}, @@ -640,7 +638,7 @@ std_name_hint_lookup::find (const char *str, size_t len) {"numbers::e_v", "", cxx20}, #line 209 "std-name-hint.gperf" {"invoke_r", "", cxx23}, -#line 441 "std-name-hint.gperf" +#line 439 "std-name-hint.gperf" {"wostringstream", "", cxx98}, #line 122 "std-name-hint.gperf" {"copy_constructible", "", cxx20}, @@ -650,13 +648,13 @@ std_name_hint_lookup::find (const char *str, size_t len) {"convertible_to", "", cxx20}, #line 234 "std-name-hint.gperf" {"setprecision", "", cxx98}, -#line 498 "std-name-hint.gperf" +#line 496 "std-name-hint.gperf" {"is_error_code_enum", "", cxx11}, -#line 453 "std-name-hint.gperf" +#line 451 "std-name-hint.gperf" {"overflow_error", "", cxx98}, #line 414 "std-name-hint.gperf" {"source_location", "", cxx20}, -#line 500 "std-name-hint.gperf" +#line 498 "std-name-hint.gperf" {"is_error_condition_enum", "", cxx11}, #line 400 "std-name-hint.gperf" {"ranges::enable_view", "", cxx20}, @@ -672,7 +670,7 @@ std_name_hint_lookup::find (const char *str, size_t len) {"chrono::parse", "", cxx20}, #line 285 "std-name-hint.gperf" {"istreambuf_iterator", "", cxx98}, -#line 473 "std-name-hint.gperf" +#line 471 "std-name-hint.gperf" {"char_traits", "", cxx98}, #line 263 "std-name-hint.gperf" {"cin", "", cxx98}, @@ -692,37 +690,37 @@ std_name_hint_lookup::find (const char *str, size_t len) {"chrono::get_tzdb", "", cxx20}, #line 302 "std-name-hint.gperf" {"allocate_shared_for_overwrite", "", cxx20}, -#line 547 "std-name-hint.gperf" +#line 545 "std-name-hint.gperf" {"unordered_multiset", "", cxx11}, #line 194 "std-name-hint.gperf" {"forward_list", "", cxx11}, -#line 496 "std-name-hint.gperf" +#line 494 "std-name-hint.gperf" {"error_condition", "", cxx11}, -#line 542 "std-name-hint.gperf" +#line 540 "std-name-hint.gperf" {"bad_typeid", "", cxx98}, #line 60 "std-name-hint.gperf" {"chrono::duration", "", cxx11}, -#line 510 "std-name-hint.gperf" +#line 508 "std-name-hint.gperf" {"apply", "", cxx17}, #line 95 "std-name-hint.gperf" {"chrono::zoned_time", "", cxx20}, -#line 477 "std-name-hint.gperf" +#line 475 "std-name-hint.gperf" {"stol", "", cxx11}, -#line 479 "std-name-hint.gperf" +#line 477 "std-name-hint.gperf" {"stoll", "", cxx11}, -#line 480 "std-name-hint.gperf" +#line 478 "std-name-hint.gperf" {"stoul", "", cxx11}, -#line 481 "std-name-hint.gperf" +#line 479 "std-name-hint.gperf" {"stoull", "", cxx11}, #line 220 "std-name-hint.gperf" {"packaged_task", "", cxx11}, -#line 544 "std-name-hint.gperf" +#line 542 "std-name-hint.gperf" {"unordered_map", "", cxx11}, #line 77 "std-name-hint.gperf" {"chrono::months", "", cxx20}, #line 76 "std-name-hint.gperf" {"chrono::minutes", "", cxx11}, -#line 545 "std-name-hint.gperf" +#line 543 "std-name-hint.gperf" {"unordered_multimap", "", cxx11}, #line 78 "std-name-hint.gperf" {"chrono::nanoseconds", "", cxx11}, @@ -732,21 +730,21 @@ std_name_hint_lookup::find (const char *str, size_t len) {"binary_semaphore", "", cxx20}, #line 281 "std-name-hint.gperf" {"end", "", cxx11}, -#line 429 "std-name-hint.gperf" +#line 428 "std-name-hint.gperf" {"wspanbuf", "", cxx23}, #line 252 "std-name-hint.gperf" {"oct", "", cxx98}, #line 245 "std-name-hint.gperf" {"noboolalpha", "", cxx98}, -#line 450 "std-name-hint.gperf" +#line 448 "std-name-hint.gperf" {"length_error", "", cxx98}, -#line 560 "std-name-hint.gperf" +#line 558 "std-name-hint.gperf" {"in_place", "", cxx17}, -#line 563 "std-name-hint.gperf" +#line 561 "std-name-hint.gperf" {"in_place_t", "", cxx17}, #line 384 "std-name-hint.gperf" {"emit_on_flush", "", cxx20}, -#line 440 "std-name-hint.gperf" +#line 438 "std-name-hint.gperf" {"wistringstream", "", cxx98}, #line 327 "std-name-hint.gperf" {"static_pointer_cast", "", cxx11}, @@ -762,7 +760,7 @@ std_name_hint_lookup::find (const char *str, size_t len) {"wostream", "", cxx98}, #line 348 "std-name-hint.gperf" {"lock", "", cxx11}, -#line 504 "std-name-hint.gperf" +#line 502 "std-name-hint.gperf" {"system_category", "", cxx11}, #line 128 "std-name-hint.gperf" {"copyable", "", cxx20}, @@ -770,21 +768,21 @@ std_name_hint_lookup::find (const char *str, size_t len) {"condition_variable", "", cxx11}, #line 240 "std-name-hint.gperf" {"fixed", "", cxx98}, -#line 553 "std-name-hint.gperf" +#line 551 "std-name-hint.gperf" {"cmp_greater_equal", "", cxx20}, -#line 508 "std-name-hint.gperf" +#line 506 "std-name-hint.gperf" {"thread", "", cxx11}, -#line 439 "std-name-hint.gperf" +#line 437 "std-name-hint.gperf" {"stringstream", "", cxx98}, #line 58 "std-name-hint.gperf" {"chrono::clock_cast", "", cxx20}, -#line 579 "std-name-hint.gperf" +#line 577 "std-name-hint.gperf" {"unreachable", "", cxx23}, -#line 428 "std-name-hint.gperf" +#line 427 "std-name-hint.gperf" {"wospanstream", "", cxx23}, #line 330 "std-name-hint.gperf" {"unique_ptr", "", cxx11}, -#line 562 "std-name-hint.gperf" +#line 560 "std-name-hint.gperf" {"in_place_index_t", "", cxx17}, #line 363 "std-name-hint.gperf" {"nothrow", "", cxx98}, @@ -800,7 +798,7 @@ std_name_hint_lookup::find (const char *str, size_t len) {"uint_fast32_t", "", cxx11}, #line 87 "std-name-hint.gperf" {"chrono::time_point", "", cxx11}, -#line 444 "std-name-hint.gperf" +#line 442 "std-name-hint.gperf" {"stack", "", cxx98}, #line 215 "std-name-hint.gperf" {"unwrap_reference", "", cxx20}, @@ -814,7 +812,7 @@ std_name_hint_lookup::find (const char *str, size_t len) {"optional", "", cxx17}, #line 112 "std-name-hint.gperf" {"signed_integral", "", cxx20}, -#line 456 "std-name-hint.gperf" +#line 454 "std-name-hint.gperf" {"underflow_error", "", cxx98}, #line 239 "std-name-hint.gperf" {"defaultfloat", "", cxx11}, @@ -832,19 +830,19 @@ std_name_hint_lookup::find (const char *str, size_t len) {"uninitialized_construct_using_allocator", "", cxx20}, #line 81 "std-name-hint.gperf" {"chrono::remote_version", "", cxx20}, -#line 458 "std-name-hint.gperf" +#line 456 "std-name-hint.gperf" {"bfloat16_t", "", cxx23}, -#line 576 "std-name-hint.gperf" +#line 574 "std-name-hint.gperf" {"piecewise_construct", "", cxx11}, -#line 577 "std-name-hint.gperf" +#line 575 "std-name-hint.gperf" {"piecewise_construct_t", "", cxx11}, #line 278 "std-name-hint.gperf" {"const_iterator", "", cxx23}, -#line 484 "std-name-hint.gperf" +#line 482 "std-name-hint.gperf" {"to_wstring", "", cxx17}, #line 356 "std-name-hint.gperf" {"try_lock", "", cxx11}, -#line 561 "std-name-hint.gperf" +#line 559 "std-name-hint.gperf" {"in_place_index", "", cxx17}, #line 51 "std-name-hint.gperf" {"atomic_ref", "", cxx20}, @@ -862,7 +860,7 @@ std_name_hint_lookup::find (const char *str, size_t len) {"uncaught_exceptions", "", cxx17}, #line 331 "std-name-hint.gperf" {"uses_allocator", "", cxx11}, -#line 472 "std-name-hint.gperf" +#line 470 "std-name-hint.gperf" {"basic_string", "", cxx98}, #line 311 "std-name-hint.gperf" {"default_delete", "", cxx11}, @@ -870,17 +868,17 @@ std_name_hint_lookup::find (const char *str, size_t len) {"expected", "", cxx23}, #line 313 "std-name-hint.gperf" {"destroy_at", "", cxx20}, -#line 536 "std-name-hint.gperf" +#line 534 "std-name-hint.gperf" {"type_identity_t", "", cxx20}, #line 63 "std-name-hint.gperf" {"chrono::from_stream", "", cxx20}, -#line 427 "std-name-hint.gperf" +#line 426 "std-name-hint.gperf" {"wispanstream", "", cxx23}, #line 52 "std-name-hint.gperf" {"atomic_signed_lock_free", "", cxx11}, #line 266 "std-name-hint.gperf" {"wcerr", "", cxx98}, -#line 511 "std-name-hint.gperf" +#line 509 "std-name-hint.gperf" {"forward_as_tuple", "", cxx11}, #line 187 "std-name-hint.gperf" {"vformat", "", cxx20}, @@ -892,25 +890,25 @@ std_name_hint_lookup::find (const char *str, size_t len) {"destroy_n", "", cxx20}, #line 226 "std-name-hint.gperf" {"get_time", "", cxx11}, -#line 555 "std-name-hint.gperf" +#line 553 "std-name-hint.gperf" {"cmp_less_equal", "", cxx20}, #line 80 "std-name-hint.gperf" {"chrono::reload_tzdb", "", cxx20}, -#line 523 "std-name-hint.gperf" +#line 521 "std-name-hint.gperf" {"conjunction", "", cxx17}, #line 75 "std-name-hint.gperf" {"chrono::milliseconds", "", cxx11}, #line 59 "std-name-hint.gperf" {"chrono::days", "", cxx20}, -#line 474 "std-name-hint.gperf" +#line 472 "std-name-hint.gperf" {"stod", "", cxx11}, -#line 478 "std-name-hint.gperf" +#line 476 "std-name-hint.gperf" {"stold", "", cxx11}, #line 267 "std-name-hint.gperf" {"wcin", "", cxx98}, -#line 529 "std-name-hint.gperf" +#line 527 "std-name-hint.gperf" {"invoke_result", "", cxx17}, -#line 530 "std-name-hint.gperf" +#line 528 "std-name-hint.gperf" {"invoke_result_t", "", cxx17}, #line 50 "std-name-hint.gperf" {"atomic", "", cxx11}, @@ -930,17 +928,17 @@ std_name_hint_lookup::find (const char *str, size_t len) {"chrono::hours", "", cxx11}, #line 109 "std-name-hint.gperf" {"common_reference_with", "", cxx20}, -#line 483 "std-name-hint.gperf" +#line 481 "std-name-hint.gperf" {"to_string", "", cxx17}, -#line 524 "std-name-hint.gperf" +#line 522 "std-name-hint.gperf" {"conjunction_v", "", cxx17}, -#line 578 "std-name-hint.gperf" +#line 576 "std-name-hint.gperf" {"to_underlying", "", cxx23}, #line 402 "std-name-hint.gperf" {"scoped_allocator_adaptor", "", cxx11}, #line 310 "std-name-hint.gperf" {"construct_at", "", cxx20}, -#line 564 "std-name-hint.gperf" +#line 562 "std-name-hint.gperf" {"in_place_type", "", cxx17}, #line 320 "std-name-hint.gperf" {"make_shared_for_overwrite", "", cxx20}, @@ -952,15 +950,15 @@ std_name_hint_lookup::find (const char *str, size_t len) {"chrono::local_t", "", cxx20}, #line 170 "std-name-hint.gperf" {"basic_format_string", "", cxx20}, -#line 565 "std-name-hint.gperf" +#line 563 "std-name-hint.gperf" {"in_place_type_t", "", cxx17}, #line 279 "std-name-hint.gperf" {"counted_iterator", "", cxx20}, -#line 448 "std-name-hint.gperf" +#line 446 "std-name-hint.gperf" {"domain_error", "", cxx98}, #line 84 "std-name-hint.gperf" {"chrono::steady_clock", "", cxx11}, -#line 580 "std-name-hint.gperf" +#line 578 "std-name-hint.gperf" {"observable_checkpoint", "", cxx26}, #line 188 "std-name-hint.gperf" {"vformat_to", "", cxx20}, @@ -982,51 +980,49 @@ std_name_hint_lookup::find (const char *str, size_t len) {"unwrap_ref_decay_t", "", cxx20}, #line 136 "std-name-hint.gperf" {"strict_weak_order", "", cxx20}, -#line 437 "std-name-hint.gperf" +#line 435 "std-name-hint.gperf" {"ostringstream", "", cxx98}, #line 317 "std-name-hint.gperf" {"get_deleter", "", cxx11}, #line 367 "std-name-hint.gperf" {"numbers::egamma_v", "", cxx20}, -#line 566 "std-name-hint.gperf" +#line 564 "std-name-hint.gperf" {"in_range", "", cxx20}, -#line 558 "std-name-hint.gperf" +#line 556 "std-name-hint.gperf" {"exchange", "", cxx14}, -#line 551 "std-name-hint.gperf" +#line 549 "std-name-hint.gperf" {"cmp_equal", "", cxx20}, -#line 556 "std-name-hint.gperf" +#line 554 "std-name-hint.gperf" {"cmp_not_equal", "", cxx20}, -#line 435 "std-name-hint.gperf" - {"istringstream", "", cxx98}, -#line 436 "std-name-hint.gperf" +#line 434 "std-name-hint.gperf" {"istringstream", "", cxx98}, -#line 442 "std-name-hint.gperf" +#line 440 "std-name-hint.gperf" {"wstringbuf", "", cxx98}, #line 225 "std-name-hint.gperf" {"get_money", "", cxx11}, #line 191 "std-name-hint.gperf" {"wformat_parse_context", "", cxx20}, -#line 482 "std-name-hint.gperf" +#line 480 "std-name-hint.gperf" {"string", "", cxx98}, #line 280 "std-name-hint.gperf" {"distance", "", cxx98}, -#line 557 "std-name-hint.gperf" +#line 555 "std-name-hint.gperf" {"declval", "", cxx11}, #line 254 "std-name-hint.gperf" {"scientific", "", cxx98}, #line 98 "std-name-hint.gperf" {"strong_equality", "", cxx20}, -#line 487 "std-name-hint.gperf" +#line 485 "std-name-hint.gperf" {"u8string", "", cxx20}, #line 190 "std-name-hint.gperf" {"wformat_context", "", cxx20}, #line 312 "std-name-hint.gperf" {"destroy", "", cxx20}, -#line 559 "std-name-hint.gperf" +#line 557 "std-name-hint.gperf" {"forward", "", cxx11}, -#line 535 "std-name-hint.gperf" +#line 533 "std-name-hint.gperf" {"type_identity", "", cxx20}, -#line 464 "std-name-hint.gperf" +#line 462 "std-name-hint.gperf" {"stop_callback", "", cxx20}, #line 86 "std-name-hint.gperf" {"chrono::tai_clock", "", cxx20}, @@ -1038,7 +1034,7 @@ std_name_hint_lookup::find (const char *str, size_t len) {"chrono::tzdb", "", cxx20}, #line 126 "std-name-hint.gperf" {"totally_ordered_with", "", cxx20}, -#line 525 "std-name-hint.gperf" +#line 523 "std-name-hint.gperf" {"disjunction", "", cxx17}, #line 110 "std-name-hint.gperf" {"common_with", "", cxx20}, @@ -1058,23 +1054,23 @@ std_name_hint_lookup::find (const char *str, size_t len) {"weak_ordering", "", cxx20}, #line 201 "std-name-hint.gperf" {"ifstream", "", cxx98}, -#line 452 "std-name-hint.gperf" +#line 450 "std-name-hint.gperf" {"out_of_range", "", cxx98}, #line 264 "std-name-hint.gperf" {"clog", "", cxx98}, #line 62 "std-name-hint.gperf" {"chrono::file_clock", "", cxx20}, -#line 526 "std-name-hint.gperf" +#line 524 "std-name-hint.gperf" {"disjunction_v", "", cxx17}, -#line 485 "std-name-hint.gperf" +#line 483 "std-name-hint.gperf" {"u16string", "", cxx11}, #line 351 "std-name-hint.gperf" {"once_flag", "", cxx11}, -#line 491 "std-name-hint.gperf" +#line 489 "std-name-hint.gperf" {"string_view", "", cxx17}, #line 304 "std-name-hint.gperf" {"allocator_arg", "", cxx11}, -#line 486 "std-name-hint.gperf" +#line 484 "std-name-hint.gperf" {"u32string", "", cxx11}, #line 213 "std-name-hint.gperf" {"unwrap_ref_decay", "", cxx20}, @@ -1086,11 +1082,11 @@ std_name_hint_lookup::find (const char *str, size_t len) {"derived_from", "", cxx20}, #line 99 "std-name-hint.gperf" {"strong_ordering", "", cxx20}, -#line 497 "std-name-hint.gperf" +#line 495 "std-name-hint.gperf" {"generic_category", "", cxx11}, #line 125 "std-name-hint.gperf" {"totally_ordered", "", cxx20}, -#line 494 "std-name-hint.gperf" +#line 492 "std-name-hint.gperf" {"error_category", "", cxx11}, #line 82 "std-name-hint.gperf" {"chrono::round", "", cxx17}, @@ -1098,15 +1094,15 @@ std_name_hint_lookup::find (const char *str, size_t len) {"unique_lock", "", cxx11}, #line 319 "std-name-hint.gperf" {"make_shared", "", cxx11}, -#line 507 "std-name-hint.gperf" +#line 505 "std-name-hint.gperf" {"this_thread", "", cxx11}, -#line 449 "std-name-hint.gperf" +#line 447 "std-name-hint.gperf" {"invalid_argument", "", cxx98}, #line 354 "std-name-hint.gperf" {"scoped_lock", "", cxx17}, #line 268 "std-name-hint.gperf" {"wclog", "", cxx98}, -#line 506 "std-name-hint.gperf" +#line 504 "std-name-hint.gperf" {"jthread", "", cxx20}, #line 97 "std-name-hint.gperf" {"partial_ordering", "", cxx20}, @@ -1114,7 +1110,7 @@ std_name_hint_lookup::find (const char *str, size_t len) {"chrono::high_resolution_clock", "", cxx11}, #line 307 "std-name-hint.gperf" {"assume_aligned", "", cxx20}, -#line 488 "std-name-hint.gperf" +#line 486 "std-name-hint.gperf" {"wstring", "", cxx98}, #line 192 "std-name-hint.gperf" {"wformat_string", "", cxx20}, @@ -1144,7 +1140,7 @@ std_name_hint_lookup::find (const char *str, size_t len) -1, -1, 24, -1, -1, -1, -1, -1, -1, -1, 25, 26, 27, -1, -1, -1, 28, 29, -1, -1, 30, - -630, -457, -2, 33, -1, 34, -1, + -628, -455, -2, 33, -1, 34, -1, 35, -1, 36, -1, -1, -1, -1, 37, -1, 38, -1, -1, -1, -1, -1, -1, -1, 39, -1, -1, -1, @@ -1186,8 +1182,8 @@ std_name_hint_lookup::find (const char *str, size_t len) -1, 152, 153, -1, -1, -1, -1, -1, -1, 154, -1, 155, 156, -1, -1, -1, 157, -1, -1, 158, -1, - 159, 160, -1, -1, -1, -934, -1, - 163, 164, -1, 165, -327, -2, -1, + 159, 160, -1, -1, -1, -932, -1, + 163, 164, -1, 165, -325, -2, -1, -1, 166, -1, -1, -1, -1, 167, 168, -1, 169, -1, -1, -1, 170, 171, 172, 173, -1, -1, -1, 174, @@ -1197,157 +1193,157 @@ std_name_hint_lookup::find (const char *str, size_t len) -1, 185, -1, 186, 187, -1, 188, 189, 190, 191, 192, -1, 193, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 194, -1, -1006, -293, + -1, -1, -1, 194, -1, -1004, -291, -2, -1, -1, -1, 197, -1, -1, 198, 199, 200, 201, -1, -1, -1, 202, 203, -1, -1, -1, -1, 204, - -1, -1, -1031, -283, -2, -1, 207, - -1, -1, -1, 208, 209, -1, -1, - -1, 210, -1, -1, -1, 211, -1, - 212, -1, -1, 213, -1, -1, 214, - -1, 215, -1, 216, 217, -1, 218, - -1, -1, 219, -1, -1, -1, 220, - -1, 221, -1, 222, 223, 224, -1, - -1, -1, 225, -1, 226, -1, -1, - -1, -1, 227, -1, 228, -1, -1, - -1, 229, 230, -1, -1, -1, -1, - -1, 231, -1, 232, 233, -1, -1, - -1, -1, 234, -1, 235, 236, 237, - 238, -1, 239, -1, 240, 241, 242, - 243, -1, -1, 244, -1, 245, -1, - 246, 247, 248, -1, -1, -1, 249, - -1, -1, -1, -1, 250, 251, -1, - -1, -1, -1, -1, -1, -1, 252, - 253, 254, 255, -1, -1, 256, 257, - 258, -1, 259, 260, -1, -1, -1, - 261, -1, -1, -1, -1, -1, 262, - 263, -1, 264, 265, -1, -1, -1, - -1, -1, -1, -1, -1, 266, -1, - 267, -1, 268, -1, -1, -1, 269, - -1, 270, -1, 271, -1, -1, 272, - -1, 273, -1, -1, -1, -1, 274, - 275, 276, -1, 277, -1, -1, -1, - -1, -1, -1, -1, -1, 278, -1, - -1, -1, -1, -1, 279, 280, 281, - -1226, 284, -206, -2, -1, -1, -1, - -1, 285, -1, -1, -1, -1, 286, - 287, 288, -1, -1, 289, 290, 291, - -1, -1, -1, -1, 292, -1, -1, - -1, -1, 293, -1, -1, 294, -1, - 295, 296, 297, 298, -1, -1, -1, - -1, -1, -1, 299, -1, -1, -1, - -1, -1, -1, 300, 301, 302, -1, - -1, -1, -1, 303, 304, -1, -1, - 305, 306, -1, -1, -1, 307, -1, - -1, -1, -1, -1, 308, -1, -1, - 309, 310, -1, -1, -1, -1, 311, - -1, -1, 312, 313, 314, -1, -1, - -1, 315, 316, -1, 317, -1, 318, - -1, -1, 319, 320, 321, 322, -1, - 323, -1, 324, 325, -1, -1, -1, - 326, 327, -1, 328, 329, -1, 330, - -1, -1, 331, -1, 332, -1, -1, - -1, -1, 333, 334, 335, -1, -1, - -1, 336, -1, -1, 337, 338, -1, - -1, -1, -1, -1368, -149, -2, -1, - 341, -1, -1, -1, -1, -1, -1, - 342, -1, -1, 343, -1, -1, -1, - -1, 344, 345, -1, 346, -1, -1, - -1, 347, -1, -1, 348, 349, -1, - -1, -1, -1, -1, 350, 351, -1, - 352, 353, -1, -1, -1, -1, 354, - -1, 355, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 356, -1, 357, -1, - -1, -1, -1, -1, 358, -1, -1, - -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 359, -1, - 360, 361, -1, 362, -1, -1, -1, - -1, -1, -1, -1, 363, -1, 364, - -1, 365, -1, 366, -1, -1, -1, - 367, 368, 369, -1, -1, 370, -1, - -1, -1, -1, 371, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, - 372, -1, 373, -1, -1, -1, 374, - -1, -1, -1, -1, 375, -1, 376, - -1, -1, -1, 377, -1, -1, -1, - 378, -1, 379, 380, -1, -1, -1, - 381, -1, 382, -1, 383, 384, -1, - -1, 385, -1, -1, -1, -1, -1, - 386, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 387, 388, - -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 389, 390, -1, + -1, -1, 205, -1, -1, -1, 206, + -1, -1, -1, 207, 208, -1, -1, + -1, 209, -1, -1, -1, 210, -1, + 211, -1, -1, 212, -1, -1, 213, + -1, 214, -1, 215, 216, -1, 217, + -1, -1, 218, -1, -1, -1, 219, + -1, 220, -1, 221, 222, 223, -1, + -1, -1, 224, -1, 225, -1, -1, + -1, -1, 226, -1, 227, -1, -1, + -1, 228, 229, -1, -1, -1, -1, + -1, 230, -1, 231, 232, -1, -1, + -1, -1, 233, -1, 234, 235, 236, + 237, -1, 238, -1, 239, 240, 241, + 242, -1, -1, 243, -1, 244, -1, + 245, 246, 247, -1, -1, -1, 248, + -1, -1, -1, -1, 249, 250, -1, + -1, -1, -1, -1, -1, -1, 251, + 252, 253, 254, -1, -1, 255, 256, + 257, -1, 258, 259, -1, -1, -1, + 260, -1, -1, -1, -1, -1, 261, + 262, -1, 263, 264, -1, -1, -1, + -1, -1, -1, -1, -1, 265, -1, + 266, -1, 267, -1, -1, -1, 268, + -1, 269, -1, 270, -1, -1, 271, + -1, 272, -1, -1, -1, -1, 273, + 274, 275, -1, 276, -1, -1, -1, + -1, -1, -1, -1, -1, 277, -1, + -1, -1, -1, -1, 278, 279, 280, + -1224, 283, -205, -2, -1, -1, -1, + -1, 284, -1, -1, -1, -1, 285, + 286, 287, -1, -1, 288, 289, 290, + -1, -1, -1, -1, 291, -1, -1, + -1, -1, 292, -1, -1, 293, -1, + 294, 295, 296, 297, -1, -1, -1, + -1, -1, -1, 298, -1, -1, -1, + -1, -1, -1, 299, 300, 301, -1, + -1, -1, -1, 302, 303, -1, -1, + 304, 305, -1, -1, -1, 306, -1, + -1, -1, -1, -1, 307, -1, -1, + 308, 309, -1, -1, -1, -1, 310, + -1, -1, 311, 312, 313, -1, -1, + -1, 314, 315, -1, 316, -1, 317, + -1, -1, 318, 319, 320, 321, -1, + 322, -1, 323, 324, -1, -1, -1, + 325, 326, -1, 327, 328, -1, 329, + -1, -1, 330, -1, 331, -1, -1, + -1, -1, 332, 333, 334, -1, -1, + -1, 335, -1, -1, 336, 337, -1, + -1, -1, -1, -1366, -148, -2, -1, + 340, -1, -1, -1, -1, -1, -1, + 341, -1, -1, 342, -1, -1, -1, + -1, 343, 344, -1, 345, -1, -1, + -1, 346, -1, -1, 347, 348, -1, + -1, -1, -1, -1, 349, 350, -1, + 351, 352, -1, -1, -1, -1, 353, + -1, 354, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 355, -1, 356, -1, + -1, -1, -1, -1, 357, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 358, -1, + 359, 360, -1, 361, -1, -1, -1, + -1, -1, -1, -1, 362, -1, 363, + -1, 364, -1, 365, -1, -1, -1, + 366, 367, 368, -1, -1, 369, -1, + -1, -1, -1, 370, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + 371, -1, 372, -1, -1, -1, 373, + -1, -1, -1, -1, 374, -1, 375, + -1, -1, -1, 376, -1, -1, -1, + 377, -1, 378, 379, -1, -1, -1, + 380, -1, 381, -1, 382, 383, -1, + -1, 384, -1, -1, -1, -1, -1, + 385, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 386, 387, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 388, 389, -1, + -1, -1, -1, -1, -1, 390, -1, -1, -1, -1, -1, -1, 391, -1, - -1, -1, -1, -1, -1, 392, -1, - -1, -1, -1, -1, 393, -1, 394, - -1, -1, -1, -1, -1, -1, 395, - 396, 397, -1, -1, 398, 399, -1, - 400, 401, 402, 403, 404, 405, 406, - 407, 408, 409, -1, -1, 410, 411, - -1, -1, -1, 412, -1, -1, -1, - -1, 413, -1, 414, -1, -1, 415, + -1, -1, -1, -1, 392, -1, 393, + -1, -1, -1, -1, -1, -1, 394, + 395, 396, -1, -1, 397, 398, -1, + 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, -1, -1, 409, 410, + -1, -1, -1, 411, -1, -1, -1, + -1, 412, -1, 413, -1, -1, 414, -1, -1, -1, -1, -1, -1, -1, - -1, 416, -1, -1, -1, 417, -1, + -1, 415, -1, -1, -1, 416, -1, -1, -1, -1, -1, -1, -1, -1, - 418, -1, -1, 419, -1, -1, 420, + 417, -1, -1, 418, -1, -1, 419, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 421, 422, -1, -1, + -1, -1, -1, 420, 421, -1, -1, + -1, -1, -1, -1, 422, -1, -1, -1, -1, -1, -1, 423, -1, -1, - -1, -1, -1, -1, 424, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 424, -1, -1, -1, -1, -1, -1, 425, -1, -1, - -1, -1, -1, -1, -1705, -62, -2, - -1, -1, -1, -1, 428, -1, -1, - -1, -1, -1, 429, -1, -1, -1, + -1, -1, -1, -1, 426, -1, -1, + -1, -1, -1, 427, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 430, -1, -1, + -1, -1, -1, -1, 428, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 431, -1, -1, -1, -1, -1, 432, - -1, -1, -1, -1, 433, -1, -1, - -1, -1, -1, -1, -1, 434, -1, - -1, -1, -1, 435, -1, -1, 436, - -1, -1, -1, -1, -1, -1, 437, - 438, -1, -1, 439, -1, -1, -1, - -1, -1, 440, 441, -1, -1, -1, - 442, -1, 443, -1, 444, -1, -1, - 445, -1, -1, -1, 446, -1, -1, + 429, -1, -1, -1, -1, -1, 430, + -1, -1, -1, -1, 431, -1, -1, + -1, -1, -1, -1, -1, 432, -1, + -1, -1, -1, 433, -1, -1, 434, + -1, -1, -1, -1, -1, -1, 435, + 436, -1, -1, 437, -1, -1, -1, + -1, -1, 438, 439, -1, -1, -1, + 440, -1, 441, -1, 442, -1, -1, + 443, -1, -1, -1, 444, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 447, - -1, 448, -1, -1, -1, -1, -1, - 449, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 445, + -1, 446, -1, -1, -1, -1, -1, + 447, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 450, -1, 451, -1, - -1, -1, -1, -1, 452, -1, -1, - -1, -1, -1, 453, -1, -1, -1, - -1, -1, 454, -1, -1, 455, -1, + -1, -1, -1, 448, -1, 449, -1, + -1, -1, -1, -1, 450, -1, -1, + -1, -1, -1, 451, -1, -1, -1, + -1, -1, 452, -1, -1, 453, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 456, -1, -1, -1, 457, -1, + -1, 454, -1, -1, -1, 455, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 458, -1, 459, 460, - -1, -1, -1, -1, -1, -1, 461, + -1, -1, -1, 456, -1, 457, 458, + -1, -1, -1, -1, -1, -1, 459, + -1, -1, -1, -1, 460, -1, -1, + -1, -1, 461, -1, -1, -1, -1, -1, -1, -1, -1, 462, -1, -1, - -1, -1, 463, -1, -1, -1, -1, - -1, -1, -1, -1, 464, -1, -1, - -1, -1, -1, 465, -1, -1, -1, - -1, -1, -1, 466, -1, -1, -1, + -1, -1, -1, 463, -1, -1, -1, + -1, -1, -1, 464, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 467, -1, -1, + -1, -1, -1, -1, 465, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 468, -1, -1, -1, 469, + -1, -1, 466, -1, -1, -1, 467, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 470, + -1, -1, -1, -1, -1, -1, 468, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -1356,22 +1352,22 @@ std_name_hint_lookup::find (const char *str, size_t len) -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 471, -1, -1, -1, -1, -1, + -1, 469, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 472, -1, 473, -1, + -1, -1, -1, 470, -1, 471, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 474, -1, -1, -1, -1, + -1, -1, 472, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 475, -1, - -1, 476, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 473, -1, + -1, 474, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 477, -1, -1, -1, -1, -1, -1, + 475, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -1382,14 +1378,14 @@ std_name_hint_lookup::find (const char *str, size_t len) -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 478, -1, -1, + -1, -1, -1, -1, 476, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 479, 480, 481, -1, + -1, -1, -1, 477, 478, 479, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 482, -1, + -1, -1, -1, -1, -1, 480, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -1404,12 +1400,12 @@ std_name_hint_lookup::find (const char *str, size_t len) -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 483, -1, -1, -1, -1, -1, + -1, 481, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 484, -1, -1, -1, + -1, -1, -1, 482, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -1417,12 +1413,12 @@ std_name_hint_lookup::find (const char *str, size_t len) -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 485, -1, - -1, -1, -1, -1, -1, 486, -1, + -1, -1, -1, -1, -1, 483, -1, + -1, -1, -1, -1, -1, 484, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 487 + 485 }; if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 882c0820a6e6..8aaedaeb3b30 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -7311,11 +7311,16 @@ the attribute. When the field that represents the number of the elements is assigned a negative integer value, the compiler treats the value as zero. -The @code{counted_by} attribute is not allowed for a pointer to @code{void}, -a pointer to function, or a pointer to a structure or union that includes -a flexible array member. However, it is allowed for a pointer to -non-void incomplete structure or union types, as long as the type could -be completed before the first reference to the pointer. +The @code{counted_by} attribute is not allowed for a pointer to function, +or a pointer to a structure or union that includes a flexible array member. +However, it is allowed for a pointer to non-void incomplete structure +or union types, as long as the type could be completed before the first +reference to the pointer. + +The attribute is allowed for a pointer to @code{void}. However, +warnings will be issued for such cases when @option{-Wpointer-arith} is +specified. When this attribute is applied on a pointer to @code{void}, +the size of each element of this pointer array is treated as 1. An explicit @code{counted_by} annotation defines a relationship between two objects, @code{p->array} and @code{p->count}, and there are the diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index b40fc892fa0d..32b9c48f155c 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -1097,7 +1097,7 @@ Objective-C and Objective-C++ Dialects}. -mfpu=@var{fpu-type} -msimd=@var{simd-type} -msoft-float -msingle-float -mdouble-float -mlsx -mno-lsx -mlasx -mno-lasx -mbranch-cost=@var{n} -maddr-reg-reg-cost=@var{n} -mcheck-zero-division --mno-check-zero-division +-mno-check-zero-division -mbreak-code=@var{code} -mcond-move-int -mno-cond-move-int -mcond-move-float -mno-cond-move-float -memcpy -mno-memcpy -mstrict-align -mno-strict-align -G @var{num} @@ -28457,6 +28457,17 @@ Trap (do not trap) on integer division by zero. The default is @option{-mcheck-zero-division} for @option{-O0} or @option{-Og}, and @option{-mno-check-zero-division} for other optimization levels. +@opindex mbreak-code +@item -mbreak-code=@var{code} +Emit a @code{break} @var{code} instruction for irrecoverable traps +from @code{__builtin_trap} or inserted by the compiler (for example +an erroneous path isolated with +@option{-fisolate-erroneous-paths-dereference}), or an +@code{amswap.w $r0, $r1, $r0} instruction which will cause the hardware +to trigger an Instruction Not-defined Exception if @var{code} is negative +or greater than 32767. The default is -1, meaning to use the +@code{amswap.w} instruction. + @opindex mcond-move-int @item -mcond-move-int @itemx -mno-cond-move-int diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc index a817c69c95af..ac39cf51f747 100644 --- a/gcc/dwarf2out.cc +++ b/gcc/dwarf2out.cc @@ -13842,14 +13842,14 @@ gen_btf_tag_dies (tree attr, dw_die_ref die) if (die) { - /* Add AT_GNU_annotation referring to the annotation DIE. - It may have already been added, some global declarations are processed - twice, but if so it must be the same or we have a bug. */ - dw_die_ref existing = get_AT_ref (die, DW_AT_GNU_annotation); - if (existing) - gcc_checking_assert (existing == tag_die); - else - add_AT_die_ref (die, DW_AT_GNU_annotation, tag_die); + /* Add (or replace) AT_GNU_annotation referring to the annotation DIE. + Replacement may happen for example when 'die' is a global variable + which has been re-declared multiple times. In any case, the set of + input attributes is the one that ought to be reflected. For global + variable re-declarations which add additional decl tags, they will + have been accumulated in the variable's DECL_ATTRIBUTES for us. */ + remove_AT (die, DW_AT_GNU_annotation); + add_AT_die_ref (die, DW_AT_GNU_annotation, tag_die); } return tag_die; diff --git a/gcc/expr.cc b/gcc/expr.cc index 4a699101bb5a..7d84ad9e6fc2 100644 --- a/gcc/expr.cc +++ b/gcc/expr.cc @@ -9802,6 +9802,29 @@ expand_expr_divmod (tree_code code, machine_mode mode, tree treeop0, return expand_divmod (mod_p, code, mode, op0, op1, target, unsignedp); } +/* Return true if EXP has a range of values [0..1], false + otherwise. This works for constants and ssa names, calling back into the ranger. */ +static bool +expr_has_boolean_range (tree exp, gimple *stmt) +{ + /* An integral type with a single bit of precision. */ + if (INTEGRAL_TYPE_P (TREE_TYPE (exp)) + && TYPE_UNSIGNED (TREE_TYPE (exp)) + && TYPE_PRECISION (TREE_TYPE (exp)) == 1) + return true; + + /* Signed 1 bit integers are not boolean ranges. */ + if (!INTEGRAL_TYPE_P (TREE_TYPE (exp)) + || TYPE_PRECISION (TREE_TYPE (exp)) <= 1) + return false; + + if (TREE_CODE (exp) == SSA_NAME) + return ssa_name_has_boolean_range (exp, stmt); + if (TREE_CODE (exp) == INTEGER_CST) + return wi::leu_p (wi::to_wide (exp), 1); + return false; +} + rtx expand_expr_real_2 (const_sepops ops, rtx target, machine_mode tmode, enum expand_modifier modifier) @@ -10460,9 +10483,8 @@ expand_expr_real_2 (const_sepops ops, rtx target, machine_mode tmode, /* Expand X*Y as X&-Y when Y must be zero or one. */ if (SCALAR_INT_MODE_P (mode)) { - bool gimple_zero_one_valued_p (tree, tree (*)(tree)); - bool bit0_p = gimple_zero_one_valued_p (treeop0, nullptr); - bool bit1_p = gimple_zero_one_valued_p (treeop1, nullptr); + bool bit0_p = expr_has_boolean_range (treeop0, currently_expanding_gimple_stmt); + bool bit1_p = expr_has_boolean_range (treeop1, currently_expanding_gimple_stmt); /* Expand X*Y as X&Y when both X and Y must be zero or one. */ if (bit0_p && bit1_p) diff --git a/gcc/fold-const-call.cc b/gcc/fold-const-call.cc index 439bf8044f5e..89c1c28b60d6 100644 --- a/gcc/fold-const-call.cc +++ b/gcc/fold-const-call.cc @@ -1440,6 +1440,25 @@ fold_const_fold_left (tree type, tree arg0, tree arg1, tree_code code) return arg0; } +/* Fold a call to IFN_VEC_SHL_INSERT (ARG0, ARG1), returning a value + of type TYPE. */ + +static tree +fold_const_vec_shl_insert (tree, tree arg0, tree arg1) +{ + if (TREE_CODE (arg0) != VECTOR_CST) + return NULL_TREE; + + /* vec_shl_insert ( dup(CST), CST) -> dup (CST). */ + if (tree elem = uniform_vector_p (arg0)) + { + if (operand_equal_p (elem, arg1)) + return arg0; + } + + return NULL_TREE; +} + /* Try to evaluate: *RESULT = FN (*ARG0, *ARG1) @@ -1843,6 +1862,9 @@ fold_const_call (combined_fn fn, tree type, tree arg0, tree arg1) case CFN_FOLD_LEFT_PLUS: return fold_const_fold_left (type, arg0, arg1, PLUS_EXPR); + case CFN_VEC_SHL_INSERT: + return fold_const_vec_shl_insert (type, arg0, arg1); + case CFN_UBSAN_CHECK_ADD: case CFN_ADD_OVERFLOW: subcode = PLUS_EXPR; diff --git a/gcc/fold-const.cc b/gcc/fold-const.cc index 1311c6ed7de1..861d73ce9607 100644 --- a/gcc/fold-const.cc +++ b/gcc/fold-const.cc @@ -264,22 +264,6 @@ protected_set_expr_location_unshare (tree x, location_t loc) return x; } -/* If ARG2 divides ARG1 with zero remainder, carries out the exact - division and returns the quotient. Otherwise returns - NULL_TREE. */ - -tree -div_if_zero_remainder (const_tree arg1, const_tree arg2) -{ - widest_int quo; - - if (wi::multiple_of_p (wi::to_widest (arg1), wi::to_widest (arg2), - SIGNED, &quo)) - return wide_int_to_tree (TREE_TYPE (arg1), quo); - - return NULL_TREE; -} - /* This is nonzero if we should defer warnings about undefined overflow. This facility exists because these warnings are a special case. The code to estimate loop iterations does not want diff --git a/gcc/fold-const.h b/gcc/fold-const.h index 00975dcddd61..87e7ec15157a 100644 --- a/gcc/fold-const.h +++ b/gcc/fold-const.h @@ -153,7 +153,6 @@ extern tree build_simple_mem_ref_loc (location_t, tree); extern poly_offset_int mem_ref_offset (const_tree); extern tree build_invariant_address (tree, tree, poly_int64); extern tree constant_boolean_node (bool, tree); -extern tree div_if_zero_remainder (const_tree, const_tree); extern bool tree_swap_operands_p (const_tree, const_tree); extern enum tree_code swap_tree_comparison (enum tree_code); diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 385a62bdefe0..e7c7907b1971 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,57 @@ +2025-10-30 Mikael Morin + + * trans-array.cc: Cleanup obsolete comment. + +2025-10-29 Yuao Ma + + * trans-expr.cc (gfc_conv_gfc_desc_to_cfi_desc): Remove unreachable + code. + +2025-10-29 Paul Thomas + + PR fortran/122165 + * primary.cc (gfc_match_varspec): If the previous component ref + was a type specification parameter, a type inquiry ref cannot + follow. + +2025-10-29 Paul Thomas + + PR fortran/122433 + PR fortran/122434 + * decl.cc (gfc_get_pdt_instance): Prevent a PDT component of + the same type as the template from being converted into an + instance. + * resolve.cc (gfc_impure_variable): The result of a pure + function is a valid allocate object since it is pure. + +2025-10-28 Yuao Ma + + PR fortran/122342 + * trans-const.cc (gfc_conv_constant): Create a variable for the + non-char pointer. + +2025-10-28 Paul-Antoine Arras + + PR fortran/122439 + * openmp.cc (gfc_resolve_omp_context_selector): Skip selectors that have + OMP_TRAIT_INVALID. + +2025-10-27 Paul Thomas + + PR fortran/922290 + PR fortran/95541 + * resolve.cc (resolve_typebound_intrinsic_op): Add pdt_template + to the list of preemted specifics. + * trans-stmt.cc (trans_associate_var): PDT array and string + components are separately allocated for each element of a PDT + array, so copy in and copy out the selector expression. + +2025-10-27 Richard Biener + + PR middle-end/122325 + * options.cc (gfc_init_options_struct): Set flag_complex_method + to fortran rules. + 2025-10-26 Paul Thomas PR fortran/122290 diff --git a/gcc/fortran/decl.cc b/gcc/fortran/decl.cc index 569786abe992..5b222cd0ce51 100644 --- a/gcc/fortran/decl.cc +++ b/gcc/fortran/decl.cc @@ -3938,6 +3938,20 @@ gfc_get_pdt_instance (gfc_actual_arglist *param_list, gfc_symbol **sym, actual_param = param_list; sprintf (name, "Pdt%s", pdt->name); + /* Prevent a PDT component of the same type as the template from being + converted into an instance. Doing this results in the component being + lost. */ + if (gfc_current_state () == COMP_DERIVED + && !(gfc_state_stack->previous + && gfc_state_stack->previous->state == COMP_DERIVED) + && gfc_current_block ()->attr.pdt_template + && !strcmp (gfc_current_block ()->name, (*sym)->name)) + { + if (ext_param_list) + *ext_param_list = gfc_copy_actual_arglist (param_list); + return MATCH_YES; + } + /* Run through the parameter name list and pick up the actual parameter values or use the default values in the PDT declaration. */ for (; type_param_name_list; diff --git a/gcc/fortran/intrinsic.texi b/gcc/fortran/intrinsic.texi index 9012c2a5746d..b2d1e4559883 100644 --- a/gcc/fortran/intrinsic.texi +++ b/gcc/fortran/intrinsic.texi @@ -2239,7 +2239,7 @@ is different, the value is converted to the kind of @var{ATOM}. program atomic use iso_fortran_env logical(atomic_logical_kind) :: atom[*], prev - call atomic_cas (atom[1], prev, .false., .true.)) + call atomic_cas (atom[1], prev, .false., .true.) end program atomic @end smallexample diff --git a/gcc/fortran/openmp.cc b/gcc/fortran/openmp.cc index 357e6a7f09d0..f5db9a81ea6a 100644 --- a/gcc/fortran/openmp.cc +++ b/gcc/fortran/openmp.cc @@ -12236,6 +12236,8 @@ gfc_resolve_omp_context_selector (gfc_omp_set_selector *oss, } } + if (os->code == OMP_TRAIT_INVALID) + break; enum omp_tp_type property_kind = omp_ts_map[os->code].tp_type; gfc_omp_trait_property *otp = os->properties; diff --git a/gcc/fortran/primary.cc b/gcc/fortran/primary.cc index 2d2c664f10a3..1dcb1c3b5614 100644 --- a/gcc/fortran/primary.cc +++ b/gcc/fortran/primary.cc @@ -2690,6 +2690,14 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag, else component = NULL; + if (previous && inquiry + && (previous->attr.pdt_kind || previous->attr.pdt_len)) + { + gfc_error_now ("R901: A type parameter ref is not a designtor and " + "cannot be followed by the type inquiry ref at %C"); + return MATCH_ERROR; + } + if (intrinsic && !inquiry) { if (previous) @@ -3827,6 +3835,9 @@ gfc_match_rvalue (gfc_expr **result) gfc_typespec *ts; bool implicit_char; gfc_ref *ref; + gfc_symtree *pdt_st; + gfc_symbol *found_specific = NULL; + m = gfc_match ("%%loc"); if (m == MATCH_YES) @@ -4074,22 +4085,36 @@ gfc_match_rvalue (gfc_expr **result) break; } + gfc_gobble_whitespace (); + found_specific = NULL; + + /* Even if 'name' is that of a PDT template, priority has to be given to + possible specific procedures in the generic interface. */ + gfc_find_sym_tree (gfc_dt_upper_string (name), NULL, 1, &pdt_st); + if (sym->generic && sym->generic->next + && gfc_peek_ascii_char() != '(') + { + gfc_actual_arglist *arg = actual_arglist; + for (; arg && pdt_st; arg = arg->next) + gfc_resolve_expr (arg->expr); + found_specific = gfc_search_interface (sym->generic, 0, + &actual_arglist); + } + /* Check to see if this is a PDT constructor. The format of these constructors is rather unusual: name [(type_params)](component_values) where, component_values excludes the type_params. With the present gfortran representation this is rather awkward because the two are not distinguished, other than by their attributes. */ - if (sym->attr.generic) + if (sym->attr.generic && pdt_st != NULL && found_specific == NULL) { - gfc_symtree *pdt_st; gfc_symbol *pdt_sym; gfc_actual_arglist *ctr_arglist = NULL, *tmp; gfc_component *c; - /* Obtain the template. */ - gfc_find_sym_tree (gfc_dt_upper_string (name), NULL, 1, &pdt_st); - if (pdt_st && pdt_st->n.sym && pdt_st->n.sym->attr.pdt_template) + /* Use the template. */ + if (pdt_st->n.sym && pdt_st->n.sym->attr.pdt_template) { bool type_spec_list = false; pdt_sym = pdt_st->n.sym; @@ -4147,8 +4172,12 @@ gfc_match_rvalue (gfc_expr **result) tmp = tmp->next; } - gfc_find_sym_tree (gfc_dt_lower_string (pdt_sym->name), - NULL, 1, &symtree); + if (found_specific) + gfc_find_sym_tree (found_specific->name, + NULL, 1, &symtree); + else + gfc_find_sym_tree (gfc_dt_lower_string (pdt_sym->name), + NULL, 1, &symtree); if (!symtree) { gfc_get_ha_sym_tree (gfc_dt_lower_string (pdt_sym->name) , diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc index 117a51c7e9a3..ecd2ada36a32 100644 --- a/gcc/fortran/resolve.cc +++ b/gcc/fortran/resolve.cc @@ -18956,7 +18956,8 @@ gfc_impure_variable (gfc_symbol *sym) { if (ns == sym->ns) break; - if (ns->proc_name->attr.flavor == FL_PROCEDURE && !sym->attr.function) + if (ns->proc_name->attr.flavor == FL_PROCEDURE + && !(sym->attr.function || sym->attr.result)) return 1; } diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc index e2b17a725be8..cb40816558e6 100644 --- a/gcc/fortran/trans-array.cc +++ b/gcc/fortran/trans-array.cc @@ -268,13 +268,7 @@ gfc_conv_descriptor_data_get (tree desc) return fold_convert (GFC_TYPE_ARRAY_DATAPTR_TYPE (type), field); } -/* This provides WRITE access to the data field. - - TUPLES_P is true if we are generating tuples. - - This function gets called through the following macros: - gfc_conv_descriptor_data_set - gfc_conv_descriptor_data_set. */ +/* This provides WRITE access to the data field. */ void gfc_conv_descriptor_data_set (stmtblock_t *block, tree desc, tree value) diff --git a/gcc/fortran/trans-const.cc b/gcc/fortran/trans-const.cc index f70f36284a38..b1bf5671e080 100644 --- a/gcc/fortran/trans-const.cc +++ b/gcc/fortran/trans-const.cc @@ -444,6 +444,8 @@ gfc_conv_constant (gfc_se * se, gfc_expr * expr) if (expr->ts.type == BT_CHARACTER) gfc_conv_string_parameter (se); else - se->expr = gfc_build_addr_expr (NULL_TREE, se->expr); + se->expr + = gfc_build_addr_expr (NULL_TREE, + gfc_trans_force_lval (&se->pre, se->expr)); } } diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc index 67b60c78aa75..2e88e65b6b87 100644 --- a/gcc/fortran/trans-expr.cc +++ b/gcc/fortran/trans-expr.cc @@ -6090,9 +6090,6 @@ gfc_conv_gfc_desc_to_cfi_desc (gfc_se *parmse, gfc_expr *e, gfc_symbol *fsym) se.want_pointer = 1; gfc_conv_expr (&se, e); gfc = se.expr; - /* gfc_conv_constant ignores se.want_poiner, e.g. for string_cst. */ - if (!POINTER_TYPE_P (TREE_TYPE (gfc))) - gfc = gfc_build_addr_expr (NULL, gfc); } else { diff --git a/gcc/fortran/trans-intrinsic.cc b/gcc/fortran/trans-intrinsic.cc index 89a03d874ecb..5b9111d3faee 100644 --- a/gcc/fortran/trans-intrinsic.cc +++ b/gcc/fortran/trans-intrinsic.cc @@ -12844,14 +12844,6 @@ conv_intrinsic_atomic_cas (gfc_code *code) new_val = gfc_build_addr_expr (NULL_TREE, tmp); } - /* Convert a constant to a pointer. */ - if (!POINTER_TYPE_P (TREE_TYPE (comp))) - { - tmp = gfc_create_var (TREE_TYPE (TREE_TYPE (old)), "comp"); - gfc_add_modify (&block, tmp, fold_convert (TREE_TYPE (tmp), comp)); - comp = gfc_build_addr_expr (NULL_TREE, tmp); - } - gfc_init_se (&argse, NULL); gfc_get_caf_token_offset (&argse, &token, &offset, caf_decl, atom, atom_expr); diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc index edcc04adc08c..8f72dbb929be 100644 --- a/gcc/gimple-fold.cc +++ b/gcc/gimple-fold.cc @@ -5233,24 +5233,6 @@ gimple_fold_builtin_constant_p (gimple_stmt_iterator *gsi) return true; } -/* Fold __builtin_assume_aligned builtin. */ - -static bool -gimple_fold_builtin_assume_aligned (gimple_stmt_iterator *gsi) -{ - if (!fold_before_rtl_expansion_p ()) - return false; - - gcall *call = as_a(gsi_stmt (*gsi)); - - if (gimple_call_num_args (call) < 2) - return false; - - gimplify_and_update_call_from_tree (gsi, gimple_call_arg (call, 0)); - - return true; -} - /* If va_list type is a simple pointer and nothing special is needed, optimize __builtin_va_start (&ap, 0) into ap = __builtin_next_arg (0), __builtin_va_end (&ap) out as NOP and __builtin_va_copy into a simple @@ -5548,9 +5530,6 @@ gimple_fold_builtin (gimple_stmt_iterator *gsi) case BUILT_IN_CONSTANT_P: return gimple_fold_builtin_constant_p (gsi); - case BUILT_IN_ASSUME_ALIGNED: - return gimple_fold_builtin_assume_aligned (gsi); - default:; } diff --git a/gcc/gimple-range-op.cc b/gcc/gimple-range-op.cc index c9bc5c0c6b90..3a22606180bb 100644 --- a/gcc/gimple-range-op.cc +++ b/gcc/gimple-range-op.cc @@ -150,6 +150,10 @@ gimple_range_op_handler::gimple_range_op_handler (gimple *s) if (TREE_CODE (ssa) == SSA_NAME) m_op1 = ssa; } + // VIEW_CONVERT_EXPR needs to descend one level deeper to pick + // up the symbolic operand. + if (TREE_CODE (m_op1) == VIEW_CONVERT_EXPR) + m_op1 = TREE_OPERAND (m_op1, 0); if (gimple_num_ops (m_stmt) >= 3) m_op2 = gimple_assign_rhs2 (m_stmt); // Check that operands are supported types. One check is enough. diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog index ed189f9ce2e8..05fc802719ac 100644 --- a/gcc/go/ChangeLog +++ b/gcc/go/ChangeLog @@ -1,3 +1,9 @@ +2025-10-27 Richard Biener + + PR middle-end/122325 + * go-lang.cc (go_langhook_init_options_struct): Remove set of + flag_default_complex_method. + 2025-07-15 Jakub Jelinek Jason Merrill diff --git a/gcc/ipa-icf.cc b/gcc/ipa-icf.cc index b354fb1e704c..c7596f9ff1c6 100644 --- a/gcc/ipa-icf.cc +++ b/gcc/ipa-icf.cc @@ -2166,7 +2166,9 @@ sem_item_optimizer::write_summary (void) !lsei_end_p (lsei); lsei_next_in_partition (&lsei)) { - symtab_node *node = lsei_node (lsei); + symtab_node *node = dyn_cast (lsei_node (lsei)); + if (!node) + continue; if (m_symtab_node_map.get (node)) count++; @@ -2179,7 +2181,9 @@ sem_item_optimizer::write_summary (void) !lsei_end_p (lsei); lsei_next_in_partition (&lsei)) { - symtab_node *node = lsei_node (lsei); + symtab_node *node = dyn_cast (lsei_node (lsei)); + if (!node) + continue; sem_item **item = m_symtab_node_map.get (node); @@ -2233,7 +2237,7 @@ sem_item_optimizer::read_section (lto_file_decl_data *file_data, for (i = 0; i < count; i++) { unsigned int index; - symtab_node *node; + toplevel_node *node; lto_symtab_encoder_t encoder; index = streamer_read_uhwi (&ib_main); @@ -2241,12 +2245,11 @@ sem_item_optimizer::read_section (lto_file_decl_data *file_data, node = lto_symtab_encoder_deref (encoder, index); hashval_t hash = streamer_read_uhwi (&ib_main); - gcc_assert (node->definition); + if (symtab_node *snode = dyn_cast (node)) + gcc_assert (snode->definition); - if (is_a (node)) + if (cgraph_node *cnode = dyn_cast (node)) { - cgraph_node *cnode = dyn_cast (node); - sem_function *fn = new sem_function (cnode, &m_bmstack); unsigned count = streamer_read_uhwi (&ib_main); inchash::hash hstate (0); @@ -2263,10 +2266,8 @@ sem_item_optimizer::read_section (lto_file_decl_data *file_data, fn->set_hash (hash); m_items.safe_push (fn); } - else + else if (varpool_node *vnode = dyn_cast (node)) { - varpool_node *vnode = dyn_cast (node); - sem_variable *var = new sem_variable (vnode, &m_bmstack); var->set_hash (hash); m_items.safe_push (var); diff --git a/gcc/ipa-modref.cc b/gcc/ipa-modref.cc index d3e510195b53..a319ee35b3b6 100644 --- a/gcc/ipa-modref.cc +++ b/gcc/ipa-modref.cc @@ -3752,8 +3752,8 @@ modref_write () for (i = 0; i < lto_symtab_encoder_size (encoder); i++) { - symtab_node *snode = lto_symtab_encoder_deref (encoder, i); - cgraph_node *cnode = dyn_cast (snode); + toplevel_node *tnode = lto_symtab_encoder_deref (encoder, i); + cgraph_node *cnode = dyn_cast (tnode); modref_summary_lto *r; if (cnode && cnode->definition && !cnode->alias @@ -3765,8 +3765,8 @@ modref_write () for (i = 0; i < lto_symtab_encoder_size (encoder); i++) { - symtab_node *snode = lto_symtab_encoder_deref (encoder, i); - cgraph_node *cnode = dyn_cast (snode); + toplevel_node *tnode = lto_symtab_encoder_deref (encoder, i); + cgraph_node *cnode = dyn_cast (tnode); if (cnode && cnode->definition && !cnode->alias) { diff --git a/gcc/ipa-prop.cc b/gcc/ipa-prop.cc index c8438d67ee41..1e4b6d4548d9 100644 --- a/gcc/ipa-prop.cc +++ b/gcc/ipa-prop.cc @@ -5576,8 +5576,8 @@ ipa_write_return_summaries (output_block *ob) unsigned int count = 0; for (int i = 0; i < lto_symtab_encoder_size (encoder); i++) { - symtab_node *snode = lto_symtab_encoder_deref (encoder, i); - cgraph_node *cnode = dyn_cast (snode); + toplevel_node *tnode = lto_symtab_encoder_deref (encoder, i); + cgraph_node *cnode = dyn_cast (tnode); ipa_return_value_summary *v; if (cnode && cnode->definition && !cnode->alias @@ -5589,8 +5589,8 @@ ipa_write_return_summaries (output_block *ob) for (int i = 0; i < lto_symtab_encoder_size (encoder); i++) { - symtab_node *snode = lto_symtab_encoder_deref (encoder, i); - cgraph_node *cnode = dyn_cast (snode); + toplevel_node *tnode = lto_symtab_encoder_deref (encoder, i); + cgraph_node *cnode = dyn_cast (tnode); ipa_return_value_summary *v; if (cnode && cnode->definition && !cnode->alias @@ -5865,8 +5865,8 @@ ipcp_write_transformation_summaries (void) for (int i = 0; i < lto_symtab_encoder_size (encoder); i++) { - symtab_node *snode = lto_symtab_encoder_deref (encoder, i); - cgraph_node *cnode = dyn_cast (snode); + toplevel_node *tnode = lto_symtab_encoder_deref (encoder, i); + cgraph_node *cnode = dyn_cast (tnode); if (!cnode) continue; ipcp_transformation *ts = ipcp_get_transformation_summary (cnode); @@ -5879,8 +5879,8 @@ ipcp_write_transformation_summaries (void) for (int i = 0; i < lto_symtab_encoder_size (encoder); i++) { - symtab_node *snode = lto_symtab_encoder_deref (encoder, i); - cgraph_node *cnode = dyn_cast (snode); + toplevel_node *tnode = lto_symtab_encoder_deref (encoder, i); + cgraph_node *cnode = dyn_cast (tnode); if (!cnode) continue; ipcp_transformation *ts = ipcp_get_transformation_summary (cnode); diff --git a/gcc/ipa-reference.cc b/gcc/ipa-reference.cc index 975341c9f6f3..173c7a59dd22 100644 --- a/gcc/ipa-reference.cc +++ b/gcc/ipa-reference.cc @@ -1070,8 +1070,8 @@ ipa_reference_write_optimization_summary (void) /* See what variables we are interested in. */ for (i = 0; i < lto_symtab_encoder_size (encoder); i++) { - symtab_node *snode = lto_symtab_encoder_deref (encoder, i); - varpool_node *vnode = dyn_cast (snode); + toplevel_node *tnode = lto_symtab_encoder_deref (encoder, i); + varpool_node *vnode = dyn_cast (tnode); int id; if (vnode @@ -1089,8 +1089,8 @@ ipa_reference_write_optimization_summary (void) if (ltrans_statics_bitcount) for (i = 0; i < lto_symtab_encoder_size (encoder); i++) { - symtab_node *snode = lto_symtab_encoder_deref (encoder, i); - cgraph_node *cnode = dyn_cast (snode); + toplevel_node *tnode = lto_symtab_encoder_deref (encoder, i); + cgraph_node *cnode = dyn_cast (tnode); if (cnode && write_node_summary_p (cnode, encoder, ltrans_statics)) count++; } @@ -1104,15 +1104,15 @@ ipa_reference_write_optimization_summary (void) if (ltrans_statics_bitcount) for (i = 0; i < lto_symtab_encoder_size (encoder); i++) { - symtab_node *snode = lto_symtab_encoder_deref (encoder, i); - cgraph_node *cnode = dyn_cast (snode); + toplevel_node *tnode = lto_symtab_encoder_deref (encoder, i); + cgraph_node *cnode = dyn_cast (tnode); if (cnode && write_node_summary_p (cnode, encoder, ltrans_statics)) { ipa_reference_optimization_summary_t info; int node_ref; info = get_reference_optimization_summary (cnode); - node_ref = lto_symtab_encoder_encode (encoder, snode); + node_ref = lto_symtab_encoder_encode (encoder, tnode); streamer_write_uhwi_stream (ob->main_stream, node_ref); stream_out_bitmap (ob, info->statics_read, ltrans_statics, diff --git a/gcc/lra-constraints.cc b/gcc/lra-constraints.cc index b15299791745..48ce75781d4b 100644 --- a/gcc/lra-constraints.cc +++ b/gcc/lra-constraints.cc @@ -2552,7 +2552,10 @@ process_alt_operands (int only_alternative) { int regno = decode_hard_reg_constraint (p); gcc_assert (regno >= 0); - cl = REGNO_REG_CLASS (regno); + cl = NO_REGS; + int nregs = hard_regno_nregs (regno, mode); + for (int i = 0; i < nregs; ++i) + cl = reg_class_superunion[cl][REGNO_REG_CLASS (regno + i)]; CLEAR_HARD_REG_SET (hard_reg_constraint); SET_HARD_REG_BIT (hard_reg_constraint, regno); cl_filter = &hard_reg_constraint; diff --git a/gcc/lto-cgraph.cc b/gcc/lto-cgraph.cc index 5708ba046c91..4c60bf0dd74a 100644 --- a/gcc/lto-cgraph.cc +++ b/gcc/lto-cgraph.cc @@ -45,9 +45,6 @@ along with GCC; see the file COPYING3. If not see #include "symtab-thunks.h" #include "symtab-clones.h" -/* True when asm nodes has been output. */ -bool asm_nodes_output = false; - static void output_cgraph_opt_summary (void); static void input_cgraph_opt_summary (vec nodes); @@ -82,7 +79,7 @@ lto_symtab_encoder_new (bool for_input) lto_symtab_encoder_t encoder = XCNEW (struct lto_symtab_encoder_d); if (!for_input) - encoder->map = new hash_map; + encoder->map = new hash_map; encoder->nodes.create (0); return encoder; } @@ -108,7 +105,7 @@ lto_symtab_encoder_delete (lto_symtab_encoder_t encoder) int lto_symtab_encoder_encode (lto_symtab_encoder_t encoder, - symtab_node *node) + toplevel_node *node) { int ref; @@ -140,7 +137,7 @@ lto_symtab_encoder_encode (lto_symtab_encoder_t encoder, bool lto_symtab_encoder_delete_node (lto_symtab_encoder_t encoder, - symtab_node *node) + toplevel_node *node) { int index; @@ -214,7 +211,7 @@ lto_set_symtab_encoder_encode_initializer (lto_symtab_encoder_t encoder, bool lto_symtab_encoder_in_partition_p (lto_symtab_encoder_t encoder, - symtab_node *node) + toplevel_node *node) { int index = lto_symtab_encoder_lookup (encoder, node); if (index == LCC_NOT_FOUND) @@ -226,11 +223,16 @@ lto_symtab_encoder_in_partition_p (lto_symtab_encoder_t encoder, void lto_set_symtab_encoder_in_partition (lto_symtab_encoder_t encoder, - symtab_node *node) + toplevel_node *node) { int index = lto_symtab_encoder_encode (encoder, node); if (dump_file) - fprintf(dump_file, "Node %s, index %d\n", node->asm_name(), index); + { + if (symtab_node* snode = dyn_cast (node)) + fprintf (dump_file, "Node %s, index %d\n", snode->asm_name (), index); + else + fprintf (dump_file, "Asm node, index %d\n", index); + } encoder->nodes[index].in_partition = true; } @@ -770,7 +772,10 @@ output_refs (lto_symtab_encoder_t encoder) for (int i = 0; i < lto_symtab_encoder_size (encoder); i++) { - symtab_node *node = lto_symtab_encoder_deref (encoder, i); + toplevel_node *tnode = lto_symtab_encoder_deref (encoder, i); + symtab_node *node = dyn_cast (tnode); + if (!node) + continue; /* IPA_REF_ALIAS references are always preserved in the boundary. Alias node can't have other references and @@ -895,7 +900,7 @@ compute_ltrans_boundary (lto_symtab_encoder_t in_encoder) pickle those too. */ for (i = 0; i < lto_symtab_encoder_size (encoder); i++) { - symtab_node *node = lto_symtab_encoder_deref (encoder, i); + toplevel_node *node = lto_symtab_encoder_deref (encoder, i); if (varpool_node *vnode = dyn_cast (node)) { if (!lto_symtab_encoder_encode_initializer_p (encoder, @@ -962,7 +967,11 @@ compute_ltrans_boundary (lto_symtab_encoder_t in_encoder) to stay to aid local calling conventions. */ for (i = 0; i < lto_symtab_encoder_size (encoder); i++) { - symtab_node *node = lto_symtab_encoder_deref (encoder, i); + toplevel_node *tnode = lto_symtab_encoder_deref (encoder, i); + symtab_node *node = dyn_cast (tnode); + if (!node) + continue; + cgraph_node *cnode = dyn_cast (node); if (node->alias && node->analyzed) @@ -980,6 +989,13 @@ compute_ltrans_boundary (lto_symtab_encoder_t in_encoder) lto_symtab_encoder_encode (encoder, node); } } + + for (lsei = lsei_start (in_encoder); !lsei_end_p (lsei); lsei_next (&lsei)) + { + toplevel_node *tnode = lsei_node (lsei); + if (asm_node* node = dyn_cast (tnode)) + lto_set_symtab_encoder_in_partition (encoder, node); + } lto_symtab_encoder_delete (in_encoder); return encoder; } @@ -1012,11 +1028,11 @@ output_symtab (void) n_nodes = lto_symtab_encoder_size (encoder); for (i = 0; i < n_nodes; i++) { - symtab_node *node = lto_symtab_encoder_deref (encoder, i); + toplevel_node *node = lto_symtab_encoder_deref (encoder, i); if (cgraph_node *cnode = dyn_cast (node)) lto_output_node (ob, cnode, encoder); - else - lto_output_varpool_node (ob, dyn_cast (node), encoder); + else if (varpool_node *vnode = dyn_cast (node)) + lto_output_varpool_node (ob, vnode, encoder); } /* Go over the nodes in SET again to write edges. */ @@ -1036,15 +1052,9 @@ output_symtab (void) lto_destroy_simple_output_block (ob); - /* Emit toplevel asms. - When doing WPA we must output every asm just once. Since we do not partition asm - nodes at all, output them to first output. This is kind of hack, but should work - well. */ - if (!asm_nodes_output && !lto_stream_offload_p) - { - asm_nodes_output = true; - lto_output_toplevel_asms (); - } + /* Emit toplevel asms. */ + if (!lto_stream_offload_p) + lto_output_toplevel_asms (encoder); output_refs (encoder); } @@ -2111,7 +2121,7 @@ output_cgraph_opt_summary (void) n_nodes = lto_symtab_encoder_size (encoder); for (i = 0; i < n_nodes; i++) { - symtab_node *node = lto_symtab_encoder_deref (encoder, i); + toplevel_node *node = lto_symtab_encoder_deref (encoder, i); cgraph_node *cnode = dyn_cast (node); if (cnode && output_cgraph_opt_summary_p (cnode)) count++; @@ -2119,7 +2129,7 @@ output_cgraph_opt_summary (void) streamer_write_uhwi (ob, count); for (i = 0; i < n_nodes; i++) { - symtab_node *node = lto_symtab_encoder_deref (encoder, i); + toplevel_node *node = lto_symtab_encoder_deref (encoder, i); cgraph_node *cnode = dyn_cast (node); if (cnode && output_cgraph_opt_summary_p (cnode)) { diff --git a/gcc/lto-section-in.cc b/gcc/lto-section-in.cc index 1dd9520137a1..bf8621925dc8 100644 --- a/gcc/lto-section-in.cc +++ b/gcc/lto-section-in.cc @@ -448,7 +448,6 @@ lto_free_function_in_decl_state_for_node (symtab_node *node) lto_free_function_in_decl_state (*slot); node->lto_file_data->function_decl_states->clear_slot (slot); } - node->lto_file_data = NULL; } diff --git a/gcc/lto-streamer-in.cc b/gcc/lto-streamer-in.cc index be818268f85c..2efa1f33967b 100644 --- a/gcc/lto-streamer-in.cc +++ b/gcc/lto-streamer-in.cc @@ -2004,6 +2004,7 @@ lto_input_toplevel_asms (struct lto_file_decl_data *file_data, int order_base) { asm_node *node = symtab->finalize_toplevel_asm (str); node->order = streamer_read_hwi (&ib) + order_base; + node->lto_file_data = file_data; if (node->order >= symtab->order) symtab->order = node->order + 1; } diff --git a/gcc/lto-streamer-out.cc b/gcc/lto-streamer-out.cc index 308ab3416b35..d03c41f38e45 100644 --- a/gcc/lto-streamer-out.cc +++ b/gcc/lto-streamer-out.cc @@ -2554,14 +2554,18 @@ output_constructor (struct varpool_node *node, int output_order) /* Emit toplevel asms. */ void -lto_output_toplevel_asms (void) +lto_output_toplevel_asms (lto_symtab_encoder_t encoder) { struct output_block *ob; - struct asm_node *can; char *section_name; struct lto_simple_header_with_strings header; - if (!symtab->first_asm_symbol ()) + bool any_asm = false; + for (int i = 0; i < lto_symtab_encoder_size (encoder); i++) + if (is_a (lto_symtab_encoder_deref (encoder, i))) + any_asm = true; + + if (!any_asm) return; ob = create_output_block (LTO_section_asm); @@ -2569,17 +2573,22 @@ lto_output_toplevel_asms (void) /* Make string 0 be a NULL string. */ streamer_write_char_stream (ob->string_stream, 0); - for (can = symtab->first_asm_symbol (); can; can = can->next) + for (int i = 0; i < lto_symtab_encoder_size (encoder); i++) { - if (TREE_CODE (can->asm_str) != STRING_CST) + toplevel_node *tnode = lto_symtab_encoder_deref (encoder, i); + asm_node *anode = dyn_cast (tnode); + if (!anode) + continue; + + if (TREE_CODE (anode->asm_str) != STRING_CST) { - sorry_at (EXPR_LOCATION (can->asm_str), + sorry_at (EXPR_LOCATION (anode->asm_str), "LTO streaming of toplevel extended % " "unimplemented"); continue; } - streamer_write_string_cst (ob, ob->main_stream, can->asm_str); - streamer_write_hwi (ob, can->order); + streamer_write_string_cst (ob, ob->main_stream, anode->asm_str); + streamer_write_hwi (ob, anode->order); } streamer_write_string_cst (ob, ob->main_stream, NULL_TREE); @@ -2783,19 +2792,12 @@ create_order_remap (lto_symtab_encoder_t encoder) { auto_vec orders; unsigned i; - struct asm_node* anode; encoder->order_remap = new hash_map, int>; unsigned n_nodes = lto_symtab_encoder_size (encoder); for (i = 0; i < n_nodes; i++) orders.safe_push (lto_symtab_encoder_deref (encoder, i)->order); - if (!asm_nodes_output) - { - for (anode = symtab->first_asm_symbol (); anode; anode = anode->next) - orders.safe_push (anode->order); - } - orders.qsort (cmp_int); int ord = 0; int last_order = -1; @@ -2809,14 +2811,6 @@ create_order_remap (lto_symtab_encoder_t encoder) ord++; } } - - /* Asm nodes are currently always output only into first partition. - We can remap already here. */ - if (!asm_nodes_output) - { - for (anode = symtab->first_asm_symbol (); anode; anode = anode->next) - anode->order = *encoder->order_remap->get (anode->order); - } } /* Main entry point from the pass manager. */ @@ -2831,6 +2825,13 @@ lto_output (void) lto_symtab_encoder_t encoder = lto_get_out_decl_state ()->symtab_node_encoder; auto_vec symbols_to_copy; + if (!flag_wpa) + { + asm_node *anode; + for (anode = symtab->first_asm_symbol (); anode; anode = anode->next) + lto_set_symtab_encoder_in_partition (encoder, anode); + } + create_order_remap (encoder); prune_offload_funcs (); @@ -2851,16 +2852,18 @@ lto_output (void) section copying. */ for (i = 0; i < n_nodes; i++) { - symtab_node *snode = lto_symtab_encoder_deref (encoder, i); - if (snode->alias) + toplevel_node *tnode = lto_symtab_encoder_deref (encoder, i); + symtab_node *node = dyn_cast (tnode); + if (!node || node->alias) continue; - if (cgraph_node *node = dyn_cast (snode)) + + if (cgraph_node *node = dyn_cast (tnode)) { if (lto_symtab_encoder_encode_body_p (encoder, node) && !node->clone_of) symbols_to_copy.safe_push (node); } - else if (varpool_node *node = dyn_cast (snode)) + else if (varpool_node *node = dyn_cast (tnode)) { /* Wrap symbol references inside the ctor in a type preserving MEM_REF. */ @@ -3202,7 +3205,10 @@ produce_symtab (struct output_block *ob) for (lsei = lsei_start (encoder); !lsei_end_p (lsei); lsei_next (&lsei)) { - symtab_node *node = lsei_node (lsei); + toplevel_node *tnode = lsei_node (lsei); + symtab_node *node = dyn_cast (tnode); + if (!node) + continue; if (DECL_EXTERNAL (node->decl) || !node->output_to_lto_symbol_table_p ()) continue; @@ -3212,7 +3218,10 @@ produce_symtab (struct output_block *ob) for (lsei = lsei_start (encoder); !lsei_end_p (lsei); lsei_next (&lsei)) { - symtab_node *node = lsei_node (lsei); + toplevel_node *tnode = lsei_node (lsei); + symtab_node *node = dyn_cast (tnode); + if (!node) + continue; if (!DECL_EXTERNAL (node->decl) || !node->output_to_lto_symbol_table_p ()) continue; @@ -3253,7 +3262,10 @@ produce_symtab_extension (struct output_block *ob, for (lsei = lsei_start (encoder); !lsei_end_p (lsei); lsei_next (&lsei)) { - symtab_node *node = lsei_node (lsei); + toplevel_node *tnode = lsei_node (lsei); + symtab_node *node = dyn_cast (tnode); + if (!node) + continue; if (DECL_EXTERNAL (node->decl) || !node->output_to_lto_symbol_table_p ()) continue; @@ -3263,7 +3275,10 @@ produce_symtab_extension (struct output_block *ob, for (lsei = lsei_start (encoder); !lsei_end_p (lsei); lsei_next (&lsei)) { - symtab_node *node = lsei_node (lsei); + toplevel_node *tnode = lsei_node (lsei); + symtab_node *node = dyn_cast (tnode); + if (!node) + continue; if (!DECL_EXTERNAL (node->decl) || !node->output_to_lto_symbol_table_p ()) continue; diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h index 4b7209e3d82d..a398f4394be3 100644 --- a/gcc/lto-streamer.h +++ b/gcc/lto-streamer.h @@ -444,12 +444,12 @@ struct lto_stats_d struct lto_encoder_entry { /* Constructor. */ - lto_encoder_entry (symtab_node* n) + lto_encoder_entry (toplevel_node* n) : node (n), in_partition (false), body (false), only_for_inlining (true), initializer (false) {} - symtab_node *node; + toplevel_node *node; /* Is the node in this partition (i.e. ltrans of this partition will be responsible for outputting it)? */ unsigned int in_partition:1; @@ -468,7 +468,7 @@ struct lto_encoder_entry struct lto_symtab_encoder_d { vec nodes; - hash_map *map; + hash_map *map; /* Mapping of input order of nodes onto output order. */ hash_map, int> *order_remap; @@ -897,7 +897,7 @@ extern void lto_output_fn_decl_ref (struct lto_out_decl_state *, struct lto_output_stream *, tree); extern tree lto_input_var_decl_ref (lto_input_block *, lto_file_decl_data *); extern tree lto_input_fn_decl_ref (lto_input_block *, lto_file_decl_data *); -extern void lto_output_toplevel_asms (void); +extern void lto_output_toplevel_asms (lto_symtab_encoder_t); extern void produce_asm (struct output_block *ob); extern void lto_output (); extern void produce_asm_for_decls (); @@ -916,19 +916,18 @@ void lto_prepare_function_for_streaming (cgraph_node *); /* In lto-cgraph.cc */ -extern bool asm_nodes_output; lto_symtab_encoder_t lto_symtab_encoder_new (bool); -int lto_symtab_encoder_encode (lto_symtab_encoder_t, symtab_node *); +int lto_symtab_encoder_encode (lto_symtab_encoder_t, toplevel_node *); void lto_symtab_encoder_delete (lto_symtab_encoder_t); -bool lto_symtab_encoder_delete_node (lto_symtab_encoder_t, symtab_node *); +bool lto_symtab_encoder_delete_node (lto_symtab_encoder_t, toplevel_node *); bool lto_symtab_encoder_encode_body_p (lto_symtab_encoder_t, struct cgraph_node *); bool lto_symtab_encoder_only_for_inlining_p (lto_symtab_encoder_t, struct cgraph_node *); bool lto_symtab_encoder_in_partition_p (lto_symtab_encoder_t, - symtab_node *); + toplevel_node *); void lto_set_symtab_encoder_in_partition (lto_symtab_encoder_t, - symtab_node *); + toplevel_node *); bool lto_symtab_encoder_encode_initializer_p (lto_symtab_encoder_t, varpool_node *); @@ -1104,7 +1103,7 @@ lto_symtab_encoder_size (lto_symtab_encoder_t encoder) inline int lto_symtab_encoder_lookup (lto_symtab_encoder_t encoder, - symtab_node *node) + toplevel_node *node) { size_t *slot = encoder->map->get (node); return (slot && *slot ? *(slot) - 1 : LCC_NOT_FOUND); @@ -1125,7 +1124,7 @@ lsei_next (lto_symtab_encoder_iterator *lsei) } /* Return the node pointed to by LSI. */ -inline symtab_node * +inline toplevel_node * lsei_node (lto_symtab_encoder_iterator lsei) { return lsei.encoder->nodes[lsei.index].node; @@ -1147,7 +1146,7 @@ lsei_varpool_node (lto_symtab_encoder_iterator lsei) /* Return the cgraph node corresponding to REF using ENCODER. */ -inline symtab_node * +inline toplevel_node * lto_symtab_encoder_deref (lto_symtab_encoder_t encoder, int ref) { if (ref == LCC_NOT_FOUND) diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 55e08838fb4f..c059e064e446 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,46 @@ +2025-10-30 Michal Jires + + * lto.cc (stream_out_partitions): Remove asm_nodes_out. + +2025-10-30 Michal Jires + + * lto-partition.cc (create_partition_if_empty): New. + (node_into_file_partition): Break out from ... + (lto_1_to_1_map): ... here. Partition toplevel assembly. + (create_asm_partition): New. + (lto_max_map): Use create_asm_partition. + (lto_balanced_map): Likewise. + +2025-10-30 Michal Jires + + * lto-partition.cc (add_symbol_to_partition): Use toplevel_node. + (undo_partition): Likewise. + (join_partitions): Likewise. + (split_partition_into_nodes): Likewise. + (is_partition_reorder): Likewise. + (lto_balanced_map): Likewise. + (lto_promote_cross_file_statics): Likewise. + * lto.cc (lto_wpa_write_files): Likewise. + +2025-10-30 Michal Jires + + * lto-partition.cc (lto_balanced_map): Simplify. + +2025-10-30 Michal Jires + + * lto-symtab.cc (lto_symtab_merge_symbols_1): likewise. + +2025-10-30 Michal Jires + + * lto-partition.cc (cmp_partitions_order): Reverse sort. + (node_cmp): Reverse sort. + +2025-10-27 Richard Biener + + PR middle-end/122325 + * lto-lang.cc (lto_init_options_struct): Remove set of + flag_default_complex_method. + 2025-10-01 Jan Hubicka * Make-lang.in: Add lto_FDAS; enable FDA collection diff --git a/gcc/lto/lto-partition.cc b/gcc/lto/lto-partition.cc index c7e69ee31614..baeafc7fafd2 100644 --- a/gcc/lto/lto-partition.cc +++ b/gcc/lto/lto-partition.cc @@ -43,7 +43,8 @@ along with GCC; see the file COPYING3. If not see vec ltrans_partitions; -static void add_symbol_to_partition (ltrans_partition part, symtab_node *node); +static void add_symbol_to_partition (ltrans_partition part, + toplevel_node *node); /* Helper for qsort; compare partitions and return one with smaller order. */ @@ -61,7 +62,7 @@ cmp_partitions_order (const void *a, const void *b) ordera = lto_symtab_encoder_deref (pa->encoder, 0)->order; if (lto_symtab_encoder_size (pb->encoder)) orderb = lto_symtab_encoder_deref (pb->encoder, 0)->order; - return orderb - ordera; + return ordera - orderb; } /* Create new partition with name NAME. @@ -87,6 +88,15 @@ new_partition (const char *name) return part; } +/* If the cgraph is empty, create one cgraph node set so that there is still + an output file for any variables that need to be exported in a DSO. */ +static void +create_partition_if_empty () +{ + if (!ltrans_partitions.length ()) + new_partition ("empty"); +} + /* Free memory used by ltrans partition. Encoder can be kept to be freed after streaming. */ static void @@ -266,9 +276,15 @@ contained_in_symbol (symtab_node *node) of other symbol definition, add the other symbol, too. */ static void -add_symbol_to_partition (ltrans_partition part, symtab_node *node) +add_symbol_to_partition (ltrans_partition part, toplevel_node *tnode) { symtab_node *node1; + symtab_node* node = dyn_cast (tnode); + if (!node) + { + lto_set_symtab_encoder_in_partition (part->encoder, tnode); + return; + } /* Verify that we do not try to duplicate something that cannot be. */ gcc_checking_assert (node->get_partitioning_class () == SYMBOL_DUPLICATE @@ -299,22 +315,53 @@ undo_partition (ltrans_partition partition, unsigned int n_nodes) { while (lto_symtab_encoder_size (partition->encoder) > (int)n_nodes) { - symtab_node *node = lto_symtab_encoder_deref (partition->encoder, - n_nodes); - partition->symbols--; - cgraph_node *cnode; + toplevel_node *tnode = lto_symtab_encoder_deref (partition->encoder, + n_nodes); /* After UNDO we no longer know what was visited. */ if (partition->initializers_visited) delete partition->initializers_visited; partition->initializers_visited = NULL; - if (!node->alias && (cnode = dyn_cast (node)) - && node->get_partitioning_class () == SYMBOL_PARTITION) - partition->insns -= ipa_size_summaries->get (cnode)->size; - lto_symtab_encoder_delete_node (partition->encoder, node); - node->aux = (void *)((size_t)node->aux - 1); + lto_symtab_encoder_delete_node (partition->encoder, tnode); + + if (symtab_node* node = dyn_cast (tnode)) + { + partition->symbols--; + cgraph_node *cnode; + if (!node->alias && (cnode = dyn_cast (node)) + && node->get_partitioning_class () == SYMBOL_PARTITION) + partition->insns -= ipa_size_summaries->get (cnode)->size; + node->aux = (void *)((size_t)node->aux - 1); + } + } +} + +/* Insert node into its file partition. */ +static void +node_into_file_partition (toplevel_node* node, + hash_map& pmap) +{ + ltrans_partition partition; + + struct lto_file_decl_data *file_data = node->lto_file_data; + + if (file_data) + { + ltrans_partition *slot = &pmap.get_or_insert (file_data); + if (*slot) + partition = *slot; + else + { + partition = new_partition (file_data->file_name); + *slot = partition; + } } + else + partition = new_partition (""); + + add_symbol_to_partition (partition, node); } /* Group cgrah nodes by input files. This is used mainly for testing @@ -324,10 +371,7 @@ void lto_1_to_1_map (void) { symtab_node *node; - struct lto_file_decl_data *file_data; hash_map pmap; - ltrans_partition partition; - int npartitions = 0; FOR_EACH_SYMBOL (node) { @@ -335,41 +379,38 @@ lto_1_to_1_map (void) || symbol_partitioned_p (node)) continue; - file_data = node->lto_file_data; - - if (file_data) - { - ltrans_partition *slot = &pmap.get_or_insert (file_data); - if (*slot) - partition = *slot; - else - { - partition = new_partition (file_data->file_name); - *slot = partition; - npartitions++; - } - } - else if (!file_data && ltrans_partitions.length ()) - partition = ltrans_partitions[0]; - else - { - partition = new_partition (""); - npartitions++; - } - - add_symbol_to_partition (partition, node); + node_into_file_partition (node, pmap); } - /* If the cgraph is empty, create one cgraph node set so that there is still - an output file for any variables that need to be exported in a DSO. */ - if (!npartitions) - new_partition ("empty"); + struct asm_node *anode; + for (anode = symtab->first_asm_symbol (); anode; anode = anode->next) + node_into_file_partition (anode, pmap); + + create_partition_if_empty (); /* Order partitions by order of symbols because they are linked into binary that way. */ ltrans_partitions.qsort (cmp_partitions_order); } +/* Creates partition with all toplevel assembly. + + Before toplevel asm could be partitioned, all toplevel asm was inserted + into first partition. + This function achieves similar behavior for partitionings that cannot + easily satisfy requirements of toplevel asm. */ +static void +create_asm_partition (void) +{ + struct asm_node *anode = symtab->first_asm_symbol (); + if (anode) + { + ltrans_partition partition = new_partition ("asm_nodes"); + for (; anode; anode = anode->next) + add_symbol_to_partition (partition, anode); + } +} + /* Maximal partitioning. Put every new symbol into new partition if possible. */ void @@ -377,7 +418,6 @@ lto_max_map (void) { symtab_node *node; ltrans_partition partition; - int npartitions = 0; FOR_EACH_SYMBOL (node) { @@ -386,10 +426,10 @@ lto_max_map (void) continue; partition = new_partition (node->asm_name ()); add_symbol_to_partition (partition, node); - npartitions++; } - if (!npartitions) - new_partition ("empty"); + + create_asm_partition (); + create_partition_if_empty (); } /* Helper function for qsort; sort nodes by order. */ @@ -398,7 +438,7 @@ node_cmp (const void *pa, const void *pb) { const symtab_node *a = *static_cast (pa); const symtab_node *b = *static_cast (pb); - return b->order - a->order; + return a->order - b->order; } /* Add all symtab nodes from NEXT_NODE to PARTITION in order. */ @@ -467,16 +507,17 @@ join_partitions (ltrans_partition into, ltrans_partition from) before adding any symbols to other partition. */ for (lsei = lsei_start (encoder); !lsei_end_p (lsei); lsei_next (&lsei)) { - symtab_node *node = lsei_node (lsei); - node->aux = (void *)((size_t)node->aux - 1); + if (symtab_node *node = dyn_cast (lsei_node (lsei))) + node->aux = (void *)((size_t)node->aux - 1); } for (lsei = lsei_start (encoder); !lsei_end_p (lsei); lsei_next (&lsei)) { - symtab_node *node = lsei_node (lsei); + toplevel_node *node = lsei_node (lsei); - if (symbol_partitioned_p (node)) - continue; + if (symtab_node *snode = dyn_cast (node)) + if (symbol_partitioned_p (snode)) + continue; add_symbol_to_partition (into, node); } @@ -498,16 +539,17 @@ split_partition_into_nodes (ltrans_partition part) for (lsei = lsei_start (encoder); !lsei_end_p (lsei); lsei_next (&lsei)) { - symtab_node *node = lsei_node (lsei); - node->aux = (void *)((size_t)node->aux - 1); + if (symtab_node *node = dyn_cast (lsei_node (lsei))) + node->aux = (void *)((size_t)node->aux - 1); } for (lsei = lsei_start (encoder); !lsei_end_p (lsei); lsei_next (&lsei)) { - symtab_node *node = lsei_node (lsei); + toplevel_node *node = lsei_node (lsei); - if (node->get_partitioning_class () != SYMBOL_PARTITION - || symbol_partitioned_p (node)) + symtab_node *snode = dyn_cast (node); + if (snode->get_partitioning_class () != SYMBOL_PARTITION + || symbol_partitioned_p (snode)) continue; ltrans_partition new_part = new_partition_no_push (part->name); @@ -527,8 +569,8 @@ is_partition_reorder (ltrans_partition part) for (lsei = lsei_start (encoder); !lsei_end_p (lsei); lsei_next (&lsei)) { - symtab_node *node = lsei_node (lsei); - if (node->no_reorder) + symtab_node *node = dyn_cast (lsei_node (lsei)); + if (!node || node->no_reorder) return false; } return true; @@ -1167,20 +1209,22 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size) callgraph or IPA reference edge leaving the partition contributes into COST. Every edge inside partition was earlier computed as one leaving it and thus we need to subtract it from COST. */ - while (last_visited_node < lto_symtab_encoder_size (partition->encoder)) + for (; last_visited_node < lto_symtab_encoder_size (partition->encoder); + last_visited_node++) { int j; struct ipa_ref *ref = NULL; - symtab_node *snode = lto_symtab_encoder_deref (partition->encoder, - last_visited_node); + toplevel_node *tnode = lto_symtab_encoder_deref (partition->encoder, + last_visited_node); + + symtab_node* snode = dyn_cast (tnode); + if (!snode) + continue; if (cgraph_node *node = dyn_cast (snode)) { struct cgraph_edge *edge; - - last_visited_node++; - gcc_assert (node->definition || node->weakref); /* Compute boundary cost of callgraph edges. */ @@ -1197,8 +1241,7 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size) gcc_assert (edge_cost > 0); index = lto_symtab_encoder_lookup (partition->encoder, edge->callee); - if (index != LCC_NOT_FOUND - && index < last_visited_node - 1) + if (index != LCC_NOT_FOUND && index < last_visited_node) cost -= edge_cost, internal += edge_cost; else cost += edge_cost; @@ -1216,15 +1259,12 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size) gcc_assert (edge_cost > 0); index = lto_symtab_encoder_lookup (partition->encoder, edge->caller); - if (index != LCC_NOT_FOUND - && index < last_visited_node - 1) + if (index != LCC_NOT_FOUND && index < last_visited_node) cost -= edge_cost, internal += edge_cost; else cost += edge_cost; } } - else - last_visited_node++; /* Compute boundary cost of IPA REF edges and at the same time look into variables referenced from current partition and try to add them. */ @@ -1242,8 +1282,7 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size) add_symbol_to_partition (partition, vnode); index = lto_symtab_encoder_lookup (partition->encoder, vnode); - if (index != LCC_NOT_FOUND - && index < last_visited_node - 1) + if (index != LCC_NOT_FOUND && index < last_visited_node) cost--, internal++; else cost++; @@ -1255,8 +1294,7 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size) node = dyn_cast (ref->referred); index = lto_symtab_encoder_lookup (partition->encoder, node); - if (index != LCC_NOT_FOUND - && index < last_visited_node - 1) + if (index != LCC_NOT_FOUND && index < last_visited_node) cost--, internal++; else cost++; @@ -1281,8 +1319,7 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size) add_symbol_to_partition (partition, vnode); index = lto_symtab_encoder_lookup (partition->encoder, vnode); - if (index != LCC_NOT_FOUND - && index < last_visited_node - 1) + if (index != LCC_NOT_FOUND && index < last_visited_node) cost--, internal++; else cost++; @@ -1295,8 +1332,7 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size) gcc_assert (node->definition); index = lto_symtab_encoder_lookup (partition->encoder, node); - if (index != LCC_NOT_FOUND - && index < last_visited_node - 1) + if (index != LCC_NOT_FOUND && index < last_visited_node) cost--, internal++; else cost++; @@ -1401,6 +1437,8 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size) gcc_assert (next_nodes.length () || npartitions != 1 || !best_cost || best_cost == -1); add_sorted_nodes (next_nodes, partition); + create_asm_partition (); + if (dump_file) { fprintf (dump_file, "\nPartition sizes:\n"); @@ -1872,7 +1910,10 @@ lto_promote_cross_file_statics (void) for (lsei = lsei_start (encoder); !lsei_end_p (lsei); lsei_next (&lsei)) { - symtab_node *node = lsei_node (lsei); + toplevel_node *tnode = lsei_node (lsei); + symtab_node *node = dyn_cast (tnode); + if (!node) + continue; /* If symbol is static, rename it if its assembler name clashes with anything else in this unit. */ diff --git a/gcc/lto/lto-symtab.cc b/gcc/lto/lto-symtab.cc index 66674a4415f8..8d7fc6805e92 100644 --- a/gcc/lto/lto-symtab.cc +++ b/gcc/lto/lto-symtab.cc @@ -953,11 +953,7 @@ lto_symtab_merge_symbols_1 (symtab_node *prevailing) else { DECL_INITIAL (e->decl) = error_mark_node; - if (e->lto_file_data) - { - lto_free_function_in_decl_state_for_node (e); - e->lto_file_data = NULL; - } + lto_free_function_in_decl_state_for_node (e); symtab->call_varpool_removal_hooks (dyn_cast (e)); } e->remove_all_references (); diff --git a/gcc/lto/lto.cc b/gcc/lto/lto.cc index 183634f2abf2..a4b1bc22cdf4 100644 --- a/gcc/lto/lto.cc +++ b/gcc/lto/lto.cc @@ -267,7 +267,6 @@ stream_out_partitions (char *temp_filename, int blen, int min, int max, { /* There are no free tokens, lets do the job outselves. */ stream_out_partitions_1 (temp_filename, blen, min, max); - asm_nodes_output = true; return; } } @@ -296,7 +295,6 @@ stream_out_partitions (char *temp_filename, int blen, int min, int max, if (jinfo != NULL && jinfo->is_connected) jinfo->disconnect (); } - asm_nodes_output = true; #else stream_out_partitions_1 (temp_filename, blen, min, max); #endif @@ -381,14 +379,17 @@ lto_wpa_write_files (void) !lsei_end_p (lsei); lsei_next_in_partition (&lsei)) { - symtab_node *node = lsei_node (lsei); - fprintf (symtab->dump_file, "%s ", node->dump_asm_name ()); + symtab_node *node = dyn_cast (lsei_node (lsei)); + if (node) + fprintf (symtab->dump_file, "%s ", node->dump_asm_name ()); } fprintf (symtab->dump_file, "\n Symbols in boundary: "); for (lsei = lsei_start (part->encoder); !lsei_end_p (lsei); lsei_next (&lsei)) { - symtab_node *node = lsei_node (lsei); + symtab_node *node = dyn_cast (lsei_node (lsei)); + if (!node) + continue; if (!lto_symtab_encoder_in_partition_p (part->encoder, node)) { fprintf (symtab->dump_file, "%s ", node->dump_asm_name ()); diff --git a/gcc/m2/ChangeLog b/gcc/m2/ChangeLog index 155c082512ec..bb307bb6074d 100644 --- a/gcc/m2/ChangeLog +++ b/gcc/m2/ChangeLog @@ -1,3 +1,24 @@ +2025-10-30 Gaius Mulley + + PR modula2/122485 + * gm2-compiler/M2Comp.mod (Pass0CheckDef): Add spell check + format specifier filtering on module names. + * gm2-compiler/M2MetaError.mod (errorBlock): New field + filterDef. + (initErrorBlock): Initialize filterDef. + (continuation): Add 'D' filter on definition module specifier. + (SpellHint): Rewrite to check for filterDef and defimp symbols. + (FilterOnDefinitionModule): New procedure. + * gm2-compiler/M2Quads.mod (BuildSizeFunction): Rewrite to + ensure variables are initialized. + * gm2-compiler/M2StackSpell.def (GetDefModuleSpellHint): New + procedure function. + * gm2-compiler/M2StackSpell.mod (GetDefModuleSpellHint): New + procedure function. + (CandidatePushName): New procedure. + (BuildHintStr): New procedure. + (CheckForHintStr): Rewrite. + 2025-10-24 Gaius Mulley PR modula2/122407 diff --git a/gcc/m2/gm2-compiler/M2Comp.mod b/gcc/m2/gm2-compiler/M2Comp.mod index 741daeb036d0..0190e0163664 100644 --- a/gcc/m2/gm2-compiler/M2Comp.mod +++ b/gcc/m2/gm2-compiler/M2Comp.mod @@ -851,12 +851,11 @@ BEGIN MergeDeps (DepContent, ChildDep, LibName) ELSE (* Unrecoverable error. *) - MetaErrorString1 (Sprintf1 (InitString ('file {%%1EUAF%s} containing module {%%1a} cannot be found'), + MetaErrorString1 (Sprintf1 (InitString ('file {%%1EUAF%s} containing module {%%1a} cannot be found {%%1&Ds}'), FileName), sym) END ELSE - (* Unrecoverable error. *) - MetaError1 ('the file containing the definition module {%1EMAa} cannot be found', sym) + MetaError1 ('the file containing the definition module {%1EMAa} cannot be found {%1&Ds}', sym) END ; ModuleType := Implementation ELSE @@ -928,15 +927,15 @@ BEGIN qprintf0 ('\n') ; CloseSource ELSE - (* It is quite legitimate to implement a module in C (and pretend it was a M2 + (* It is legitimate to implement a module in C (and pretend it was a M2 implementation) providing that it is not the main program module and the definition module does not declare a hidden type when -fextended-opaque is used. *) IF (NOT WholeProgram) OR (sym = Main) OR IsHiddenTypeDeclared (sym) THEN (* Unrecoverable error. *) - MetaErrorString1 (Sprintf1 (InitString ('file {%%1EUAF%s} containing module {%%1a} cannot be found'), - FileName), sym) ; + MetaErrorString1 (Sprintf1 (InitString ('file {%%1EUAF%s} containing module {%%1a} cannot be found {%%1&Ds}'), + FileName), sym) END END END diff --git a/gcc/m2/gm2-compiler/M2MetaError.mod b/gcc/m2/gm2-compiler/M2MetaError.mod index aae0f02eb100..22a155731ecd 100644 --- a/gcc/m2/gm2-compiler/M2MetaError.mod +++ b/gcc/m2/gm2-compiler/M2MetaError.mod @@ -42,7 +42,6 @@ FROM SYSTEM IMPORT ADDRESS ; FROM M2Error IMPORT MoveError ; FROM M2Debug IMPORT Assert ; FROM Storage IMPORT ALLOCATE ; -FROM M2StackSpell IMPORT GetSpellHint ; FROM Indexing IMPORT Index, InitIndex, KillIndex, GetIndice, PutIndice, DeleteIndice, HighIndice ; @@ -74,6 +73,7 @@ IMPORT M2Error ; IMPORT FilterError ; FROM FilterError IMPORT Filter, AddSymError, IsSymError ; +FROM M2StackSpell IMPORT GetDefModuleSpellHint, GetSpellHint ; CONST @@ -100,6 +100,7 @@ TYPE len, ini : INTEGER ; vowel, + filterDef, importHint, exportHint, withStackHint, @@ -533,6 +534,7 @@ BEGIN ini := 0 ; glyph := FALSE ; (* Nothing to output yet. *) vowel := FALSE ; (* Check for a vowel when outputing string? *) + filterDef := FALSE ; (* Filter on definition module list? *) importHint := FALSE; exportHint := FALSE ; withStackHint := FALSE ; @@ -1840,7 +1842,7 @@ END op ; (* - continuation := {':'|'1'|'2'|'3'|'4'|'i'|'s'|'x'|'w'} =: + continuation := {':'|'1'|'2'|'3'|'4'|'i'|'s'|'x'|'w'|'D'} =: *) PROCEDURE continuation (VAR eb: errorBlock; @@ -1860,7 +1862,8 @@ BEGIN 'i': AddImportsHint (eb) | 's': SpellHint (eb, sym, bol) | 'x': AddExportsHint (eb) | - 'w': AddWithStackHint (eb) + 'w': AddWithStackHint (eb) | + 'D': FilterOnDefinitionModule (eb) ELSE InternalFormat (eb, 'expecting one of [:1234isxw]', @@ -1956,9 +1959,15 @@ END JoinSentances ; PROCEDURE SpellHint (VAR eb: errorBlock; sym: ARRAY OF CARDINAL; bol: CARDINAL) ; BEGIN - IF (bol <= HIGH (sym)) AND IsUnknown (sym[bol]) + IF bol <= HIGH (sym) THEN - JoinSentances (eb, GetSpellHint (sym[bol])) + IF eb.filterDef AND IsDefImp (sym[bol]) + THEN + JoinSentances (eb, GetDefModuleSpellHint (sym[bol])) + ELSIF IsUnknown (sym[bol]) + THEN + JoinSentances (eb, GetSpellHint (sym[bol])) + END END END SpellHint ; @@ -1993,6 +2002,16 @@ BEGIN END AddWithStackHint ; +(* + FilterOnDefinitionModule - turn on filtering and include all the definition modules. +*) + +PROCEDURE FilterOnDefinitionModule (VAR eb: errorBlock) ; +BEGIN + eb.filterDef := TRUE +END FilterOnDefinitionModule ; + + (* changeColor - changes to color, c. *) diff --git a/gcc/m2/gm2-compiler/M2Quads.mod b/gcc/m2/gm2-compiler/M2Quads.mod index 5ceeb4f139ad..a263ce36f729 100644 --- a/gcc/m2/gm2-compiler/M2Quads.mod +++ b/gcc/m2/gm2-compiler/M2Quads.mod @@ -10697,44 +10697,43 @@ BEGIN NoOfParam) ; resulttok := functok ; ReturnVar := MakeConstLit (resulttok, MakeKey('0'), Cardinal) - ELSIF IsAModula2Type (OperandT (1)) - THEN - paramtok := OperandTok (1) ; - resulttok := MakeVirtualTok (functok, functok, paramtok) ; - BuildSizeCheckEnd (ProcSym) ; (* Quadruple generation now on. *) - ReturnVar := MakeTemporary (resulttok, ImmediateValue) ; - GenQuadO (resulttok, SizeOp, ReturnVar, NulSym, OperandT(1), TRUE) - ELSIF IsVar (OperandT (1)) - THEN - BuildSizeCheckEnd (ProcSym) ; (* Quadruple generation now on. *) - Type := GetSType (OperandT (1)) ; + ELSE paramtok := OperandTok (1) ; resulttok := MakeVirtualTok (functok, functok, paramtok) ; - IF IsUnbounded (Type) + IF IsAModula2Type (OperandT (1)) THEN - (* Eg. SIZE(a) ; where a is unbounded dereference HIGH and multiply by the TYPE. *) - dim := OperandD (1) ; - IF dim = 0 + BuildSizeCheckEnd (ProcSym) ; (* Quadruple generation now on. *) + ReturnVar := MakeTemporary (resulttok, ImmediateValue) ; + GenQuadO (resulttok, SizeOp, ReturnVar, NulSym, OperandT(1), TRUE) + ELSIF IsVar (OperandT (1)) + THEN + BuildSizeCheckEnd (ProcSym) ; (* Quadruple generation now on. *) + Type := GetSType (OperandT (1)) ; + IF IsUnbounded (Type) THEN - ReturnVar := calculateMultipicand (resulttok, OperandT (1), Type, dim) + (* Eg. SIZE(a) ; where a is unbounded dereference HIGH and multiply by the TYPE. *) + dim := OperandD (1) ; + IF dim = 0 + THEN + ReturnVar := calculateMultipicand (resulttok, OperandT (1), Type, dim) + ELSE + ReturnVar := calculateMultipicand (resulttok, OperandA (1), Type, dim) + END ELSE - ReturnVar := calculateMultipicand (resulttok, OperandA (1), Type, dim) + ReturnVar := MakeTemporary (resulttok, ImmediateValue) ; + IF Type = NulSym + THEN + MetaErrorT1 (resulttok, + 'cannot get the type and size of {%1Ead}', OperandT (1)) + END ; + GenQuadO (resulttok, SizeOp, ReturnVar, NulSym, Type, TRUE) END ELSE - ReturnVar := MakeTemporary (resulttok, ImmediateValue) ; - IF Type = NulSym - THEN - MetaErrorT1 (resulttok, - 'cannot get the type and size of {%1Ead}', OperandT (1)) - END ; - GenQuadO (resulttok, SizeOp, ReturnVar, NulSym, Type, TRUE) + MetaErrorT1 (paramtok, + '{%E}SYSTEM procedure {%kSIZE} expects a variable or type as its parameter, seen {%1Ed} {%1&s}', + OperandT (1)) ; + ReturnVar := MakeConstLit (paramtok, MakeKey('0'), Cardinal) END - ELSE - paramtok := OperandTok (1) ; - MetaErrorT1 (paramtok, - '{%E}SYSTEM procedure {%kSIZE} expects a variable or type as its parameter, seen {%1Ed} {%1&s}', - OperandT (1)) ; - ReturnVar := MakeConstLit (resulttok, MakeKey('0'), Cardinal) END ; PopN (NoOfParam+1) ; (* Destroy the arguments and function. *) PushTFtok (ReturnVar, GetSType(ProcSym), resulttok) diff --git a/gcc/m2/gm2-compiler/M2StackSpell.def b/gcc/m2/gm2-compiler/M2StackSpell.def index 7c1d00b7b592..c45074ae4c1f 100644 --- a/gcc/m2/gm2-compiler/M2StackSpell.def +++ b/gcc/m2/gm2-compiler/M2StackSpell.def @@ -59,4 +59,14 @@ PROCEDURE GetRecordField (tokno: CARDINAL; fieldName: Name) : CARDINAL ; +(* + GetDefModuleSpellHint - return a string describing a spelling + hint for the definition module name + similiar to unknown. NIL is returned + if no hint can be given. +*) + +PROCEDURE GetDefModuleSpellHint (defimp: CARDINAL) : String ; + + END M2StackSpell. diff --git a/gcc/m2/gm2-compiler/M2StackSpell.mod b/gcc/m2/gm2-compiler/M2StackSpell.mod index 7a072ae95ece..ac58c1c98d09 100644 --- a/gcc/m2/gm2-compiler/M2StackSpell.mod +++ b/gcc/m2/gm2-compiler/M2StackSpell.mod @@ -31,7 +31,7 @@ FROM SymbolTable IMPORT NulSym, IsModule, IsDefImp, IsRecord, FROM SymbolKey IMPORT PerformOperation ; FROM DynamicStrings IMPORT InitStringCharStar, InitString, Mark, string, ConCat ; FROM FormatStrings IMPORT Sprintf1, Sprintf2, Sprintf3 ; -FROM NameKey IMPORT KeyToCharStar ; +FROM NameKey IMPORT KeyToCharStar, NulName ; FROM M2MetaError IMPORT MetaErrorStringT0 ; FROM M2StackWord IMPORT StackOfWord, PushWord, PopWord, @@ -39,6 +39,7 @@ FROM M2StackWord IMPORT StackOfWord, PushWord, PopWord, NoOfItemsInStackWord, PeepWord ; FROM CDataTypes IMPORT ConstCharStar ; +FROM M2Batch IMPORT GetModuleNo ; IMPORT m2spellcheck ; FROM m2spellcheck IMPORT Candidates ; @@ -96,6 +97,60 @@ BEGIN END GetRecordField ; +(* + CandidatePushName - push a symbol name to the candidate list. +*) + +PROCEDURE CandidatePushName (cand: Candidates; sym: CARDINAL) ; +VAR + str: String ; +BEGIN + str := InitStringCharStar (KeyToCharStar (GetSymName (sym))) ; + m2spellcheck.Push (cand, string (str)) ; + INC (PushCount) +END CandidatePushName ; + + +(* + GetDefModuleSpellHint - return a string describing a spelling + hint for the definition module name + similiar to defimp. The premise is that + defimp has been misspelt. NIL is returned + if no hint can be given. +*) + +PROCEDURE GetDefModuleSpellHint (defimp: CARDINAL) : String ; +VAR + i : CARDINAL ; + sym : CARDINAL ; + cand : Candidates ; + misspell, + content : ConstCharStar ; + HintStr : String ; +BEGIN + HintStr := NIL ; + IF GetSymName (defimp) # NulName + THEN + misspell := KeyToCharStar (GetSymName (defimp)) ; + i := 1 ; + sym := GetModuleNo (i) ; + cand := m2spellcheck.InitCandidates () ; + WHILE sym # NulSym DO + IF sym # defimp + THEN + CandidatePushName (cand, sym) + END ; + INC (i) ; + sym := GetModuleNo (i) + END ; + content := m2spellcheck.FindClosestCharStar (cand, misspell) ; + HintStr := BuildHintStr (HintStr, content) ; + m2spellcheck.KillCandidates (cand) + END ; + RETURN AddPunctuation (HintStr, '?') +END GetDefModuleSpellHint ; + + (* Push - push a scope onto the spelling stack. sym might be a ModSym, DefImpSym or a varsym @@ -183,6 +238,30 @@ BEGIN END PushCandidates ; +(* + BuildHintStr - create the did you mean hint and return it + if HintStr is NIL. Otherwise append a hint + to HintStr. If content is NIL then return NIL. +*) + +PROCEDURE BuildHintStr (HintStr: String; content: ConstCharStar) : String ; +VAR + str: String ; +BEGIN + IF content # NIL + THEN + str := InitStringCharStar (content) ; + IF HintStr = NIL + THEN + RETURN Sprintf1 (Mark (InitString (", did you mean %s")), str) + ELSE + RETURN Sprintf2 (Mark (InitString ("%s or %s")), HintStr, str) + END + END ; + RETURN NIL +END BuildHintStr ; + + (* CheckForHintStr - lookup a spell hint matching misspelt. If one exists then append it to HintStr. Return HintStr. @@ -193,7 +272,6 @@ PROCEDURE CheckForHintStr (sym: CARDINAL; VAR cand : Candidates ; content: ConstCharStar ; - str : String ; BEGIN IF IsModule (sym) OR IsDefImp (sym) OR IsProcedure (sym) OR IsRecord (sym) OR IsEnumeration (sym) @@ -206,16 +284,7 @@ BEGIN content := NIL END ; m2spellcheck.KillCandidates (cand) ; - IF content # NIL - THEN - str := InitStringCharStar (content) ; - IF HintStr = NIL - THEN - RETURN Sprintf1 (Mark (InitString (", did you mean %s")), str) - ELSE - RETURN Sprintf2 (Mark (InitString ("%s or %s")), HintStr, str) - END - END + HintStr := BuildHintStr (HintStr, content) END ; RETURN HintStr END CheckForHintStr ; diff --git a/gcc/match.pd b/gcc/match.pd index b37a43713360..6aaf80eee7d5 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -2429,6 +2429,17 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) || TYPE_PRECISION (type) > 1) && wi::leu_p (tree_nonzero_bits (@1), 1)))) +/* VCE(zero_one) ==/!= false -> zero_one ==/!= 0. + This is done as SRA likes to create VCE for boolean accesses + and it helps code gneration and uninitialized variable warnings. */ +(for neeq (ne eq) + (simplify + (neeq (view_convert@0 zero_one_valued_p@1) integer_zerop) + (if (TREE_CODE (TREE_TYPE (@0)) == BOOLEAN_TYPE + && TYPE_PRECISION (TREE_TYPE (@0)) == 1 + && TYPE_UNSIGNED (TREE_TYPE (@0))) + (neeq @1 { build_zero_cst (TREE_TYPE (@1)); } )))) + /* Transform { 0 or 1 } * { 0 or 1 } into { 0 or 1 } & { 0 or 1 }. */ (simplify (mult zero_one_valued_p@0 zero_one_valued_p@1) @@ -5645,6 +5656,16 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (view_convert (view_convert @0)) (view_convert @0)) +/* Squash view_converts of BFRs if no precision is lost. */ +(simplify + (view_convert (BIT_FIELD_REF@0 @1 @2 @3)) + (if (is_gimple_reg_type (type) + && (!INTEGRAL_TYPE_P (type) + || !INTEGRAL_TYPE_P (TREE_TYPE (@0)) + || (type_has_mode_precision_p (type) + && type_has_mode_precision_p (TREE_TYPE (@0))))) + (BIT_FIELD_REF:type @1 @2 @3))) + /* For integral conversions with the same precision or pointer conversions use a NOP_EXPR instead. */ (simplify @@ -12002,3 +12023,8 @@ and, && direct_internal_fn_supported_p (IFN_AVG_CEIL, type, OPTIMIZE_FOR_BOTH)) (IFN_AVG_CEIL @0 @2))) #endif + +/* vec shift left insert (dup (A), A) -> dup(A) */ +(simplify + (IFN_VEC_SHL_INSERT (vec_duplicate@1 @0) @0) + @1) diff --git a/gcc/range-op-mixed.h b/gcc/range-op-mixed.h index 567b0cdd31bb..db31c2bc8c95 100644 --- a/gcc/range-op-mixed.h +++ b/gcc/range-op-mixed.h @@ -527,6 +527,47 @@ class operator_cast: public range_operator const irange &outer) const; }; + +class operator_view : public range_operator +{ +public: + using range_operator::fold_range; + using range_operator::op1_range; + using range_operator::update_bitmask; + bool fold_range (irange &r, tree type, + const irange &op1, const irange &op2, + relation_trio rel = TRIO_VARYING) const override; + bool fold_range (prange &r, tree type, + const prange &op1, const prange &op2, + relation_trio rel = TRIO_VARYING) const final override; + bool fold_range (irange &r, tree type, + const prange &op1, const irange &op2, + relation_trio rel = TRIO_VARYING) const final override; + bool fold_range (prange &r, tree type, + const irange &op1, const prange &op2, + relation_trio rel = TRIO_VARYING) const final override; + + bool op1_range (irange &r, tree type, + const irange &lhs, const irange &op2, + relation_trio rel = TRIO_VARYING) const override; + bool op1_range (prange &r, tree type, + const prange &lhs, const prange &op2, + relation_trio rel = TRIO_VARYING) const final override; + bool op1_range (irange &r, tree type, + const prange &lhs, const irange &op2, + relation_trio rel = TRIO_VARYING) const final override; + bool op1_range (prange &r, tree type, + const irange &lhs, const prange &op2, + relation_trio rel = TRIO_VARYING) const final override; + + void update_bitmask (irange &r, const irange &lh, + const irange &) const final override; +private: +// VIEW_CONVERT_EXPR works much like a cast between integral values, so use +// the cast operator. Non-integrals are not handled as yet. + operator_cast m_cast; +}; + class operator_plus : public range_operator { public: diff --git a/gcc/range-op.cc b/gcc/range-op.cc index 6b6bf78cb2f1..cf5b8fe960f8 100644 --- a/gcc/range-op.cc +++ b/gcc/range-op.cc @@ -60,6 +60,7 @@ operator_ge op_ge; operator_identity op_ident; operator_cst op_cst; operator_cast op_cast; +operator_view op_view; operator_plus op_plus; operator_abs op_abs; operator_minus op_minus; @@ -97,6 +98,7 @@ range_op_table::range_op_table () set (INTEGER_CST, op_cst); set (NOP_EXPR, op_cast); set (CONVERT_EXPR, op_cast); + set (VIEW_CONVERT_EXPR, op_view); set (FLOAT_EXPR, op_cast); set (FIX_TRUNC_EXPR, op_cast); set (PLUS_EXPR, op_plus); @@ -3247,6 +3249,80 @@ operator_cast::op1_range (irange &r, tree type, return true; } +// VIEW_CONVERT_EXPR works like a cast between integral values. +// If the number of bits are not the same, behaviour is undefined, +// so cast behaviour still works. + +bool +operator_view::fold_range (irange &r, tree type, + const irange &op1, const irange &op2, + relation_trio rel) const +{ + return m_cast.fold_range (r, type, op1, op2, rel); +} + +bool +operator_view::fold_range (prange &r, tree type, + const prange &op1, const prange &op2, + relation_trio rel) const +{ + return m_cast.fold_range (r, type, op1, op2, rel); +} +bool +operator_view::fold_range (irange &r, tree type, + const prange &op1, const irange &op2, + relation_trio rel) const +{ + return m_cast.fold_range (r, type, op1, op2, rel); +} + +bool +operator_view::fold_range (prange &r, tree type, + const irange &op1, const prange &op2, + relation_trio rel) const +{ + return m_cast.fold_range (r, type, op1, op2, rel); +} + +bool +operator_view::op1_range (irange &r, tree type, + const irange &lhs, const irange &op2, + relation_trio rel) const +{ + return m_cast.op1_range (r, type, lhs, op2, rel); +} + +bool +operator_view::op1_range (prange &r, tree type, + const prange &lhs, const prange &op2, + relation_trio rel) const +{ + return m_cast.op1_range (r, type, lhs, op2, rel); +} + +bool +operator_view::op1_range (irange &r, tree type, + const prange &lhs, const irange &op2, + relation_trio rel) const +{ + return m_cast.op1_range (r, type, lhs, op2, rel); +} + +bool +operator_view::op1_range (prange &r, tree type, + const irange &lhs, const prange &op2, + relation_trio rel) const +{ + return m_cast.op1_range (r, type, lhs, op2, rel); +} + +void +operator_view::update_bitmask (irange &r, const irange &lh, + const irange &rh) const +{ + m_cast.update_bitmask (r, lh, rh); +} + class operator_logical_and : public range_operator { diff --git a/gcc/rust/ChangeLog b/gcc/rust/ChangeLog index 1c49e9a13d61..556ce28d2c64 100644 --- a/gcc/rust/ChangeLog +++ b/gcc/rust/ChangeLog @@ -1,3 +1,1446 @@ +2025-10-30 Owen Avery + + * ast/rust-ast-pointer-visitor.cc (PointerVisitor::visit): + Handle the expression contained in an ErrorPropagationExpr. + * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise. + +2025-10-30 Yap Zhi Heng + + * typecheck/rust-hir-type-check-pattern.cc (visit(TuplePattern)): Update HAS_REST + case to continue to attempt to resolve pattern items after emitting size error. + +2025-10-30 Ryo Yoshida + + * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Emit + an error when the path refers to an enum itself rather than its variant. + +2025-10-30 Yap Zhi Heng + + * typecheck/rust-hir-type-check-base.cc (parse_repr_options): Changed TOKEN_TREE + assert into error, update malformed repr attribute error message to be inline + with other attribute error messages. + +2025-10-30 Lucas Ly Ba + + * ast/rust-ast.cc (Attribute::is_derive): + Change string derive to its definition. + * util/rust-attribute-values.h: + Add attribute definition derive. + * util/rust-attributes.cc (AttributeChecker::visit): + Add method check_inner_attributes. + (AttributeChecker::check_inner_attributes): + Check if there is a bad inner attribute. + * util/rust-attributes.h: + Add method check_inner_attributes in .h. + +2025-10-30 lishin + + * typecheck/rust-tyty-util.cc (TyVar::TyVar): Add null check to avoid ICE. + (TyVar::get_tyty): Return nullptr when lookup fails. + (TyVar::clone): Handle null base type safely. + (TyVar::monomorphized_clone): Add fallback for error types. + +2025-10-30 Ryo Yoshida + + * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): check + and properly emit an error when the tuple index is on a non-tuple-struct. + +2025-10-30 Philip Herron + + * backend/rust-compile-expr.cc (CompileExpr::array_copied_expr): refactor to new classes + * backend/rust-compile-pattern.cc (CompilePatternCheckExpr::visit): likewise + (CompilePatternBindings::visit): likewise + * backend/rust-compile-type.cc (TyTyResolveCompile::visit): likewise + * backend/rust-compile-type.h: likewise + * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::resolve_literal): likewise + * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): likewise + * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): likewise + * typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): likewise + * typecheck/rust-substitution-mapper.cc (SubstMapperInternal::visit): likewise + * typecheck/rust-substitution-mapper.h: likewise + * typecheck/rust-type-util.cc (unify_site_and): remove bad delete (alpine32) + * typecheck/rust-tyty-call.h: refactor to new classes + * typecheck/rust-tyty-subst.cc (SubstitutionParamMapping::clone): likewise + (SubstitutionRef::infer_substitions): likewise + * typecheck/rust-tyty-util.cc (TyVar::get_implicit_const_infer_var): likewise + * typecheck/rust-tyty-util.h: likewise + * typecheck/rust-tyty-variance-analysis-private.h: likewise + * typecheck/rust-tyty-visitor.h: likewise + * typecheck/rust-tyty.cc (BaseType::destructure): likewise + (BaseType::monomorphized_clone): likewise + (BaseType::is_concrete): likewise + (VariantDef::clone): likewise + (VariantDef::monomorphized_clone): likewise + (ArrayType::as_string): likewise + (ArrayType::get_capacity): likewise + (ArrayType::handle_substitions): likewise + (generate_tree_str): likewise + (ConstType::ConstType): likewise + (ConstParamType::ConstParamType): likewise + (ConstType::accept_vis): likewise + (ConstParamType::const_kind): likewise + (ConstParamType::get_symbol): likewise + (ConstParamType::can_resolve): likewise + (ConstParamType::resolve): likewise + (ConstParamType::accept_vis): likewise + (ConstType::set_value): likewise + (ConstType::as_string): likewise + (ConstParamType::as_string): likewise + (ConstType::clone): likewise + (ConstParamType::clone): likewise + (ConstType::get_symbol): likewise + (ConstParamType::get_name): likewise + (ConstType::can_resolve): likewise + (ConstParamType::is_equal): likewise + (ConstType::resolve): likewise + (ConstValueType::ConstValueType): likewise + (ConstValueType::const_kind): likewise + (ConstValueType::accept_vis): likewise + (ConstValueType::as_string): likewise + (ConstValueType::clone): likewise + (ConstValueType::get_name): likewise + (ConstValueType::is_equal): likewise + (ConstValueType::get_value): likewise + (ConstInferType::ConstInferType): likewise + (ConstInferType::const_kind): likewise + (ConstInferType::accept_vis): likewise + (ConstType::get_name): likewise + (ConstInferType::as_string): likewise + (ConstInferType::clone): likewise + (ConstInferType::get_name): likewise + (ConstType::is_equal): likewise + (ConstInferType::is_equal): likewise + (ConstErrorType::ConstErrorType): likewise + (ConstErrorType::const_kind): likewise + (ConstType::handle_substitions): likewise + (ConstErrorType::accept_vis): likewise + (ConstErrorType::as_string): likewise + (ConstErrorType::clone): likewise + (ConstErrorType::get_name): likewise + (ConstErrorType::is_equal): likewise + * typecheck/rust-tyty.h (class BaseConstType): likewise + (class ConstType): likewise + (class ConstParamType): likewise + (class ConstValueType): likewise + (class ConstInferType): likewise + (class ConstErrorType): likewise + * typecheck/rust-unify.cc (UnifyRules::commit): likewise + (UnifyRules::go): likewise + (UnifyRules::expect_array): likewise + (UnifyRules::expect_const): likewise + * typecheck/rust-unify.h: likewise + +2025-10-30 0xllx0 + + * ast/rust-ast.cc (Module::process_file_path): empty module early return + +2025-10-30 Pierre-Emmanuel Patry + + * util/rust-attributes.cc (check_doc_attribute): Change message. + (AttributeChecker::visit): Add doc attribute checking on traits. + +2025-10-30 Pierre-Emmanuel Patry + + * ast/rust-ast.cc (AttrInputMetaItemContainer::separate_cfg_attrs): + Avoid malformed attributes. + * util/rust-attributes.cc (AttributeChecker::visit): Change location. + +2025-10-30 Pierre-Emmanuel Patry + + * ast/rust-expr.h: Force crash when retrieving locus. + +2025-10-30 Pierre-Emmanuel Patry + + * ast/rust-ast.h: Add missing override modifier. + * ast/rust-path.h: Likewise. + +2025-10-30 Pierre-Emmanuel Patry + + * util/rust-attributes.cc (AttributeChecker::check_attribute): Recurse + within attr input for additional attribute checking. + (AttributeChecker::visit): Remove empty definition in favor of default + ast visitor definition. + * util/rust-attributes.h: Remove now unused prototypes. + +2025-10-30 Yap Zhi Heng + + * typecheck/rust-hir-type-check-pattern.cc (visit(TupleStructPattern)): + Update error for mismatched number of fields to use rich_location. + +2025-10-30 Yap Zhi Heng + + * backend/rust-compile-pattern.cc: Add compilation support for TupleStructItemsHasRest + in CompilePatternCheckExpr(TupleStructPattern) & CompilePatternBindings(TupleStructPattern) + +2025-10-30 Yap Zhi Heng + + * hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::visit(TupleStructPattern)): + Implement lowering of AST::TupleStructItemsHasRest to HIR. + * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit(TupleStructPattern)): + Add the respective type checking for AST::TupleStructItemsHasRest + * checks/errors/rust-hir-pattern-analysis.cc (lower_tuple_pattern): + Add respective pattern for HAS_REST case. + +2025-10-30 Yap Zhi Heng + + * typecheck/rust-hir-type-check-pattern.cc (visit(StructPattern)): Add type check + support for StructPatterns matching against a TUPLE type ADT. + * backend/rust-compile-pattern.cc(CompilePatternBindings::visit(StructPattern)): + Update assert to allow TUPLE type ADTs. + * hir/tree/rust-hir.cc (StructPatternField::as_string()): Improve info dumped. + +2025-10-30 Yap Zhi Heng + + * ast/rust-pattern.h (StructPatternElements): Rename has_struct_pattern_etc + to has_rest_pattern, and has_etc to has_rest to signify presense of rest + patterns more clearly. + * ast/rust-pattern.cc (StructPatternElements::as_string): Rename variables + accordingly. + * ast/rust-ast-collector.cc: Rename variables accordingly. + * expand/rust-cfg-strip.cc: Rename variables accordingly. + * parse/rust-parse-impl.h: Rename variable accordingly. + * hir/tree/rust-hir-pattern.h (StructPatternElements): Add a boolean to track + presense of rest pattern. + * hir/rust-ast-lower-pattern.cc (visit(StructPattern)): Add support for + lowering rest pattern to HIR. + * typecheck/rust-hir-type-check-pattern.cc (visit(StructPattern)): Remove + size check when rest pattern is present. + +2025-10-30 Owen Avery + + * backend/rust-compile-extern.h: Add includes. + (CompileExternItem::visit): Use get_link_name. + (CompileExternItem::get_link_name): New static member function. + * util/rust-attribute-values.h (Attributes::LINK_NAME): New + static constexpr member variable. + * util/rust-attributes.cc (__definitions): New entry for + LINK_NAME. + * util/rust-ggc.cc: Include "rust-ast.h". + (Ident::Ident): Add overload for Rust::Identifier. + * util/rust-ggc.h (class Identifier): Forward declare. + (Ident::Ident): Add overload for Rust::Identifier. + +2025-10-30 Arthur Cohen + + * expand/rust-expand-visitor.cc: Remove old visitors. + * expand/rust-expand-visitor.h: Likewise, plus inherit from PointerVisitor. + +2025-10-30 Pierre-Emmanuel Patry + + * expand/rust-macro-expand.cc: Forward invocation tree locus to + substitution context. + * expand/rust-macro-substitute-ctx.cc: Use origin location for expanded + tokens. + * expand/rust-macro-substitute-ctx.h (class SubstituteCtx): Save + invocation location. + +2025-10-30 Pierre-Emmanuel Patry + + * expand/rust-macro-expand.cc (transcribe_expression): Emit error + early. + +2025-10-30 Pierre-Emmanuel Patry + + * expand/rust-macro-substitute-ctx.cc (is_builtin_metavariable): Add + function to check builtin metavars knowledge. + (SubstituteCtx::check_repetition_amount): Do not process missing + fragment. + +2025-10-30 Philip Herron + + * backend/rust-compile-resolve-path.cc: add error diag + +2025-10-30 Philip Herron + + * hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): add error diagnostic + +2025-10-30 Philip Herron + + * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): check for error + +2025-10-30 Philip Herron + + * typecheck/rust-hir-type-check-expr.cc: remove old hack + +2025-10-30 Philip Herron + + * typecheck/rust-substitution-mapper.cc (SubstMapperInternal::visit): handle fnptr + * typecheck/rust-tyty.cc (FnPtr::handle_substitions): new + * typecheck/rust-tyty.h: likewise + +2025-10-30 Owen Avery + + * ast/rust-fmt.h (class FFIOpt): Adjust internal structure to + match a repr(C) rust enum. + +2025-10-30 Magnus-Mage + + * ast/rust-ast-collector.cc (TokenCollector::visit): Implement + FormatArgs visitor to reconstruct format_args! macro syntax. + * ast/rust-builtin-ast-nodes.h (FormatArguments): Add get_args(), + size(), and empty() accessor methods. + +2025-10-30 Philip Herron + + * typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): check for invalid capacity + +2025-10-30 Philip Herron + + * backend/rust-constexpr.cc (eval_constant_expression): port over missing bits + (eval_store_expression): likewise + (eval_call_expression): likewise + (eval_binary_expression): likewise + (eval_bit_field_ref): likewise + (eval_check_shift_p): likewise + (fold_pointer_plus_expression): likewise + (maybe_fold_addr_pointer_plus): likewise + (fold_expr): likewise + (union_active_member): likewise + (fold_indirect_ref_1): likewise + (rs_fold_indirect_ref): likewise + (rs_eval_indirect_ref): likewise + (eval_logical_expression): likewise + (eval_vector_conditional_expression): likewise + (eval_bare_aggregate): likewise + (cxx_eval_trinary_expression): likewise + (eval_and_check_array_index): likewise + (eval_array_reference): likewise + (eval_component_reference): likewise + (rs_bind_parameters_in_call): likewise + (eval_builtin_function_call): likewise + (constexpr_fn_retval): likewise + (verify_constant): likewise + (get_array_or_vector_nelts): likewise + (eval_conditional_expression): likewise + (eval_switch_expr): likewise + (eval_unary_expression): likewise + (cxx_eval_outermost_constant_expr): likewise + (potential_constant_expression_1): likewise + +2025-10-30 Philip Herron + + * backend/rust-compile-expr.cc (CompileExpr::compile_integer_literal): cleanup + * backend/rust-constexpr.cc (struct constexpr_global_ctx): port over c++ helpers + (decl_really_constant_value): likewise + (eval_constant_expression): likewise + (non_const_var_error): likewise + +2025-10-30 Owen Avery + + * parse/rust-parse-impl.h (Parser::parse_pattern): Ignore + inner patterns which fail to parse. + +2025-10-30 Owen Avery + + * ast/rust-ast-collector.cc (TokenCollector::visit): Remove + overload for TraitItemConst. + * ast/rust-ast-collector.h (TokenCollector::visit): Likewise. + * ast/rust-ast-pointer-visitor.cc (PointerVisitor::visit): + Likewise. + * ast/rust-ast-pointer-visitor.h (PointerVisitor::visit): + Likewise. + * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise. + * ast/rust-ast-visitor.h (ASTVisitor::visit): Likewise. + (DefaultASTVisitor::visit): Likewise. + * expand/rust-cfg-strip.cc (CfgStrip::visit): Likewise. + * expand/rust-cfg-strip.h (CfgStrip::visit): Likewise. + * expand/rust-derive.h (DeriveVisitor::visit): Likewise. + * expand/rust-expand-visitor.cc (ExpandVisitor::visit): + Likewise. + * expand/rust-expand-visitor.h (ExpandVisitor::visit): Likewise. + * hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Likewise. + * hir/rust-ast-lower-base.h (ASTLoweringBase::visit): Likewise. + * util/rust-attributes.cc (AttributeChecker::visit): Likewise. + * util/rust-attributes.h (AttributeChecker::visit): Likewise. + * ast/rust-ast.cc (ConstantItem::as_string): Handle missing + expression. + (TraitItemConst::as_string): Remove function definition. + (TraitItemConst::accept_vis): Remove function definition. + * ast/rust-item.h (ConstantItem::mark_for_strip): Adjust + comment. + (ConstantItem::has_expr): Make const. + (class TraitItemConst): Remove definition. + * ast/rust-ast-full-decls.h (class TraitItemConst): Remove + declaration. + * hir/rust-ast-lower-implitem.cc (ASTLowerTraitItem::visit): + Handle ConstantItem instead of TraitItemConst. + * hir/rust-ast-lower-implitem.h (ASTLowerTraitItem::visit): + Likewise. + * parse/rust-parse-impl.h (Parser::parse_trait_const): Return + pointer to ConstantItem instead of TraitItemConst. + * parse/rust-parse.h (Parser::parse_trait_const): Likewise. + +2025-10-30 Owen Avery + + * Make-lang.in: Handle source files in checks/errors/feature. + * checks/errors/rust-feature-gate.cc: Move to... + * checks/errors/feature/rust-feature-gate.cc: ...here. + * checks/errors/rust-feature-gate.h: Move to... + * checks/errors/feature/rust-feature-gate.h: ...here. + * checks/errors/rust-feature.cc: Move to... + * checks/errors/feature/rust-feature.cc: ...here. + * checks/errors/rust-feature.h: Move to... + * checks/errors/feature/rust-feature.h: ...here. + +2025-10-30 Owen Avery + + * Make-lang.in (GRS_OBJS): Remove rust-early-name-resolver.o. + * expand/rust-macro-builtins-helpers.h: Remove inclusion of + rust-early-name-resolver.h. + * expand/rust-macro-builtins.cc: Likewise. + * expand/rust-macro-expand.cc: Likewise. + * expand/rust-macro-expand.h: Likewise. + * resolve/rust-early-name-resolver.cc: Removed. + * resolve/rust-early-name-resolver.h: Removed. + +2025-10-30 Philip Herron + + * hir/tree/rust-hir-item.h: add unsafe helper + * typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): pass in abi and unsafe + * typecheck/rust-tyty.cc (BaseType::monomorphized_clone): likewise + (FnPtr::as_string): emit more info + (FnPtr::clone): update ctor call + * typecheck/rust-tyty.h: new ctor params + * typecheck/rust-unify.cc (UnifyRules::expect_fnptr): check abi and unsafe + +2025-10-30 Philip Herron + + * typecheck/rust-unify.cc (UnifyRules::expect_reference): remove clone + (UnifyRules::expect_pointer): likewise + (UnifyRules::expect_slice): likewise + (UnifyRules::expect_tuple): likewise + (UnifyRules::expect_int): likewise + (UnifyRules::expect_uint): likewise + (UnifyRules::expect_float): likewise + +2025-10-30 Owen Avery + + * Make-lang.in (GRS_OBJS): Remove entries. + * rust-lang.cc: Remove inclusion of "rust-ast-resolve-item.h". + (run_rust_tests): Remove call to rust_simple_path_resolve_test. + * resolve/rust-ast-resolve-base.cc: Removed. + * resolve/rust-ast-resolve-base.h: Removed. + * resolve/rust-ast-resolve-expr.cc: Removed. + * resolve/rust-ast-resolve-expr.h: Removed. + * resolve/rust-ast-resolve-implitem.h: Removed. + * resolve/rust-ast-resolve-item.cc: Removed. + * resolve/rust-ast-resolve-item.h: Removed. + * resolve/rust-ast-resolve-path.cc: Removed. + * resolve/rust-ast-resolve-path.h: Removed. + * resolve/rust-ast-resolve-pattern.cc: Removed. + * resolve/rust-ast-resolve-pattern.h: Removed. + * resolve/rust-ast-resolve-stmt.cc: Removed. + * resolve/rust-ast-resolve-stmt.h: Removed. + * resolve/rust-ast-resolve-struct-expr-field.cc: Removed. + * resolve/rust-ast-resolve-struct-expr-field.h: Removed. + * resolve/rust-ast-resolve-toplevel.h: Removed. + * resolve/rust-ast-resolve-type.cc: Removed. + * resolve/rust-ast-resolve-type.h: Removed. + * resolve/rust-ast-resolve.cc: Removed. + +2025-10-30 Owen Avery + + * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Use + resolve_type_path_like in overloads for TypePath, + StructExprStruct, StructExprStructBase, and + StructExprStructFields. + (resolve_type_path_like): New static function based off + Late::visit overload for TypePath. + * util/rust-unwrap-segment.h (unwrap_segment_error_string): New + inline static function definitions. + +2025-10-30 Philip Herron + + * backend/rust-compile-expr.cc (CompileExpr::visit): add guard + +2025-10-30 Philip Herron + + * backend/rust-compile-context.h: add assertions for context peeks + * backend/rust-compile-expr.cc (CompileExpr::visit): check for valid loop context + (CompileExpr::array_copied_expr): just reuse array tyty capacity value + * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): catch error + +2025-10-30 Yap Zhi Heng + + * checks/errors/rust-readonly-check.cc (collect_assignment_tuple): Implement + read-only checker for tuple patterns with rest pattern. + +2025-10-30 Yap Zhi Heng + + * backend/rust-compile-var-decl.h (CompileVarDecl::visit(TuplePattern)): Implement + variable declaration bindings for tuple patterns with rest pattern (i.e. + TuplePatternItemsHasRest). + +2025-10-30 Owen Avery + + * util/rust-attribute-values.h + (Attributes::RUSTC_ALLOW_CONST_FN_UNSTABLE): New static + constexpr member variable. + * util/rust-attributes.cc (__definitions): Add entry for + RUSTC_ALLOW_CONST_FN_UNSTABLE. + +2025-10-30 Philip Herron + + * typecheck/rust-unify.cc (UnifyRules::commit): commit hook update + (UnifyRules::go): insert implicit infer const types + +2025-10-30 Philip Herron + + * typecheck/rust-unify.cc (UnifyRules::go): unwrap the const type + +2025-10-30 Philip Herron + + * typecheck/rust-hir-type-check-base.cc (walk_types_to_constrain): track the ref as well + +2025-10-30 Philip Herron + + * typecheck/rust-tyty-subst.cc: const generic arguments dont have a value yet + +2025-10-30 Philip Herron + + * typecheck/rust-tyty.cc (VariantDef::clone): fix formatting + (VariantDef::monomorphized_clone): likewise + * typecheck/rust-tyty.h: likewise + +2025-10-30 Philip Herron + + * typecheck/rust-tyty.cc (InferType::can_eq): remove + (ErrorType::can_eq): likewise + (ADTType::can_eq): likewise + (TupleType::can_eq): likewise + (FnType::can_eq): likewise + (FnPtr::can_eq): likewise + (ClosureType::can_eq): likewise + (ArrayType::can_eq): likewise + (SliceType::can_eq): likewise + (BoolType::can_eq): likewise + (IntType::can_eq): likewise + (UintType::can_eq): likewise + (FloatType::can_eq): likewise + (USizeType::can_eq): likewise + (ISizeType::can_eq): likewise + (CharType::can_eq): likewise + (ReferenceType::can_eq): likewise + (PointerType::can_eq): likewise + (ParamType::can_eq): likewise + (ConstType::can_eq): likewise + (OpaqueType::can_eq): likewise + (StrType::can_eq): likewise + (NeverType::can_eq): likewise + (PlaceholderType::can_eq): likewise + (ProjectionType::can_eq): likewise + (DynamicObjectType::can_eq): likewise + * typecheck/rust-tyty.h: remove can_eq + * typecheck/rust-tyty-cmp.h: Removed. + +2025-10-30 Philip Herron + + * typecheck/rust-tyty.cc (ParamType::is_equal): uses types_compatable + +2025-10-30 Philip Herron + + * typecheck/rust-unify.cc (unify_error_type_node): new static node + (UnifyRules::go): likewise + (UnifyRules::expect_inference_variable): likewise + (UnifyRules::expect_adt): likewise + (UnifyRules::expect_str): likewise + (UnifyRules::expect_reference): likewise + (UnifyRules::expect_pointer): likewise + (UnifyRules::expect_param): likewise + (UnifyRules::expect_array): likewise + (UnifyRules::expect_slice): likewise + (UnifyRules::expect_fndef): likewise + (UnifyRules::expect_fnptr): likewise + (UnifyRules::expect_tuple): likewise + (UnifyRules::expect_bool): likewise + (UnifyRules::expect_char): likewise + (UnifyRules::expect_int): likewise + (UnifyRules::expect_uint): likewise + (UnifyRules::expect_float): likewise + (UnifyRules::expect_isize): likewise + (UnifyRules::expect_usize): likewise + (UnifyRules::expect_never): likewise + (UnifyRules::expect_placeholder): likewise + (UnifyRules::expect_projection): likewise + (UnifyRules::expect_dyn): likewise + (UnifyRules::expect_closure): likewise + (UnifyRules::expect_opaque): likewise + (UnifyRules::expect_const): likewise + +2025-10-30 Philip Herron + + * typecheck/rust-unify.cc (UnifyRules::Resolve): check for success + (UnifyRules::expect_inference_variable): dont clone + (UnifyRules::expect_adt): likewise + (UnifyRules::expect_str): likewise + (UnifyRules::expect_reference): likewise + (UnifyRules::expect_pointer): likewise + (UnifyRules::expect_param): likewise + (UnifyRules::expect_array): likewise + (UnifyRules::expect_slice): likewise + (UnifyRules::expect_fndef): likewise + (UnifyRules::expect_fnptr): likewise + (UnifyRules::expect_tuple): likewise + (UnifyRules::expect_bool): likewise + (UnifyRules::expect_char): likewise + (UnifyRules::expect_int): likewise + (UnifyRules::expect_uint): likewise + (UnifyRules::expect_float): likewise + (UnifyRules::expect_isize): likewise + (UnifyRules::expect_usize): likewise + (UnifyRules::expect_never): likewise + (UnifyRules::expect_placeholder): likewise + (UnifyRules::expect_projection): likewise + (UnifyRules::expect_dyn): likewise + (UnifyRules::expect_closure): likewise + +2025-10-30 Philip Herron + + * typecheck/rust-tyty.cc (BaseType::satisfies_bound): use types_compatable instead + +2025-10-30 Philip Herron + + * typecheck/rust-type-util.cc (types_compatable): add check bounds flag + (unify_site_and): likewise + * typecheck/rust-type-util.h (types_compatable): likewise + (unify_site_and): likewise + * typecheck/rust-tyty-bounds.cc: likewise + * typecheck/rust-unify.cc (UnifyRules::UnifyRules): likewise + (UnifyRules::Resolve): likewise + (UnifyRules::resolve_subtype): likewise + (UnifyRules::go): likewise + * typecheck/rust-unify.h: likewise + +2025-10-30 Philip Herron + + * typecheck/rust-hir-path-probe.cc (PathProbeType::process_impl_item_candidate): + refactor to types_compatable + +2025-10-30 Philip Herron + + * typecheck/rust-unify.cc (UnifyRules::expect_inference_variable): dont commit + (UnifyRules::expect_adt): likewise + (UnifyRules::expect_bool): likewise + (UnifyRules::expect_char): likewise + (UnifyRules::expect_int): likewise + (UnifyRules::expect_uint): likewise + (UnifyRules::expect_float): likewise + (UnifyRules::expect_isize): likewise + (UnifyRules::expect_usize): likewise + +2025-10-30 Philip Herron + + * backend/rust-compile-base.h: remove const + * backend/rust-compile-expr.cc: likewise + * backend/rust-compile.cc (HIRCompileBase::coerce_to_dyn_object): likewise + * typecheck/rust-hir-type-bounds.h: likewise + * typecheck/rust-type-util.cc (lookup_associated_impl_block): likewise + * typecheck/rust-type-util.h (lookup_associated_impl_block): likewise + * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::TypeBoundsProbe): likewise + (TypeBoundsProbe::Probe): likewise + * typecheck/rust-tyty-cmp.h: likewise + * typecheck/rust-tyty-subst.cc (SubstitutionRef::monomorphize): likewise + * typecheck/rust-tyty.cc (BaseType::satisfies_bound): likewise + (BaseType::bounds_compatible): likewise + (VariantDef::clone): likewise + (VariantDef::monomorphized_clone): likewise + (OpaqueType::is_equal): likewise + (DynamicObjectType::is_equal): likewise + * typecheck/rust-tyty.h: likewise + +2025-10-30 Philip Herron + + * typecheck/rust-coercion.cc (TypeCoercionRules::select): respect try flag + +2025-10-30 Pierre-Emmanuel Patry + + * resolve/rust-early-name-resolver-2.0.cc (Early::finalize_rebind_import): + Replace assert with early break and remove early return. + (Early::visit): Check for unsuffixed lower self list. + * resolve/rust-early-name-resolver-2.0.h: Add visit function prototype. + +2025-10-30 Pierre-Emmanuel Patry + + * resolve/rust-early-name-resolver-2.0.cc (Early::visit): Emit an error + on top level rebind self use declaration. + +2025-10-30 Owen Avery + + * Make-lang.in (GRS_OBJS): Add "rust-resolve-builtins.o". + * resolve/rust-late-name-resolver-2.0.cc: Include + "rust-resolve-builtins.h". + (next_node_id): Remove function. + (next_hir_id): Likewise. + (Late::setup_builtin_types): Likewise. + (Late::go): Use Builtins::setup_type_ctx instead of + Late::setup_builtin_types. + * resolve/rust-late-name-resolver-2.0.h + (Late::setup_builtin_types): Remove function. + * rust-session-manager.cc: Include "rust-resolve-builtins.h". + (Session::expansion): Call Builtins::setup_lang_prelude. + * resolve/rust-resolve-builtins.cc: New file. + * resolve/rust-resolve-builtins.h: New file. + +2025-10-30 Owen Avery + + * parse/rust-parse-impl.h (Parser::left_denotation): Remove + usage of parse_tuple_index_expr_float. + (Parser::parse_closure_expr_pratt): Remove function. + +2025-10-30 Pierre-Emmanuel Patry + + * rust-session-manager.cc (Session::compile_crate): Move the AST dump + after parser error check. + +2025-10-30 Arthur Cohen + + * ast/rust-expression-yeast.cc (ExpressionYeast::dispatch): Rename to... + (ExpressionYeast::reseat): ...this. + (ExpressionYeast::visit): Remove. + * ast/rust-expression-yeast.h: Inherit from PointerVisitor, override reseat instead + of declaring dispatch. + +2025-10-30 Arthur Cohen + + * Make-lang.in: Compile it. + * ast/rust-builtin-ast-nodes.h: Add missing methods for getting pointers. + * ast/rust-expr.h: Likewise. + * ast/rust-item.h: Likewise. + * ast/rust-path.h: Likewise. + * ast/rust-pattern.h: Likewise. + * ast/rust-type.h: Likewise. + * ast/rust-ast-pointer-visitor.cc: New file. + * ast/rust-ast-pointer-visitor.h: New file. + +2025-10-30 Pierre-Emmanuel Patry + + * ast/rust-expr.h (class TupleIndexExpr): Store strip information. + +2025-10-30 Owen Avery + + * checks/errors/borrowck/rust-bir-builder-internal.h: Remove + inclusion of "rust-name-resolver.h". + (BuilderContext::resolver): Change type to nr2.0 resolver. + (BuilderContext::BuilderContext): Change initialization of + resolver reference. + (AbstractBuilder::resolve_label): Assume name resolution 2.0 is + enabled. + (AbstractBuilder::resolve_variable): Likewise. + (AbstractBuilder::resolve_variable_or_fn): Likewise. + +2025-10-30 Owen Avery + + * checks/errors/rust-hir-pattern-analysis.cc: Remove inclusion + of "options.h". + (PatternChecker::PatternChecker): Change initialization of + resolver reference. + (PatternChecker::visit): Assume name resolution 2.0 is enabled. + * checks/errors/rust-hir-pattern-analysis.h: Include nr2.0 + header instead of nr1.0 header. + (PatternChecker::resolver): Change type to nr2.0 resolver. + +2025-10-30 Owen Avery + + * rust-session-manager.cc: Remove inclusion of name resolution + 1.0 headers. + (Session::compile_crate): Assume name resolution 2.0 is enabled. + (Session::expansion): Likewise. + (Session::load_extern_crate): Likewise. + +2025-10-30 Owen Avery + + * checks/errors/privacy/rust-privacy-check.cc: Adjust includes. + (Resolver::resolve): Pass 2.0 name resolution context to + VisibilityResolver and PrivacyReporter. + * checks/errors/privacy/rust-privacy-reporter.cc + (PrivacyReporter::PrivacyReporter): Change type of resolver + parameter. + (is_child_module): Remove static function. + (PrivacyReporter::check_for_privacy_violation): Assume nr2.0 is + enabled and handle removal of is_child_module. + * checks/errors/privacy/rust-privacy-reporter.h: Adjust + includes. + (PrivacyReporter::PrivacyReporter): Change type of resolver + parameter. + (PrivacyReporter::resolver): Change member variable type. + * checks/errors/privacy/rust-visibility-resolver.cc: Adjust + includes. + (VisibilityResolver::VisibilityResolver): Change type of + resolver parameter. + (VisibilityResolver::resolve_module_path): Assume nr2.0 is + enabled. + * checks/errors/privacy/rust-visibility-resolver.h: Adjust + includes. + (VisibilityResolver::VisibilityResolver): Change type of + resolver parameter. + (VisibilityResolver::resolver): Change member variable type. + +2025-10-30 Yap Zhi Heng + + * ast/rust-pattern.h: + - Add a new base abstract class `PatternItems` which are used by pattern items class + class derivatives for `TuplePattern`, `TupleStructPattern` & `SlicePattern`. + - Standardized the derived class names to have `HasRest` or `NoRest` as suffixes. + - Values for the common `ItemType` enum is updated to `HAS_REST` or `NO_REST`. + * ast/rust-pattern.cc: Renamed the classes accordingly. + * ast/rust-ast-collector.cc: Renamed the classes accordingly. + * ast/rust-ast-collector.h: Renamed the classes accordingly. + * ast/rust-ast-full-decls.h: Renamed the classes accordingly. + * ast/rust-ast-visitor.cc: Renamed the classes accordingly. + * ast/rust-ast-visitor.h: Renamed the classes accordingly. + * ast/rust-desugar-for-loops.cc: Renamed the classes accordingly. + * ast/rust-desugar-question-mark.cc: Renamed the classes accordingly. + * expand/rust-cfg-strip.cc: Renamed the classes accordingly. + * expand/rust-cfg-strip.h: Renamed the classes accordingly. + * expand/rust-derive-clone.cc: Renamed the classes accordingly. + * expand/rust-derive-cmp-common.cc: Renamed the classes accordingly. + * expand/rust-derive-hash.cc: Renamed the classes accordingly. + * expand/rust-derive-ord.cc: Renamed the classes accordingly. + * expand/rust-derive-partial-eq.cc: Renamed the classes accordingly. + * expand/rust-derive.h: Renamed the classes accordingly. + * expand/rust-expand-visitor.cc: Renamed the classes accordingly. + * expand/rust-expand-visitor.h: Renamed the classes accordingly. + * hir/rust-ast-lower-base.cc: Renamed the classes accordingly. + * hir/rust-ast-lower-base.h: Renamed the classes accordingly. + * hir/rust-ast-lower-pattern.cc: Renamed the classes accordingly. + * hir/tree/rust-hir-pattern.h: Renamed the classes accordingly. + * parse/rust-parse-impl.h: Renamed the classes accordingly. + * resolve/rust-ast-resolve-base.cc: Renamed the classes accordingly. + * resolve/rust-ast-resolve-base.h: Renamed the classes accordingly. + * resolve/rust-ast-resolve-pattern.cc: Renamed the classes accordingly. + * util/rust-attributes.cc: Renamed the classes accordingly. + * util/rust-attributes.h: Renamed the classes accordingly. + +2025-10-30 Owen Avery + + * ast/rust-ast-collector.cc (TokenCollector::visit): Use + should_have_str instead of has_str. + * ast/rust-ast.cc (Token::as_string): Likewise. + * expand/rust-macro-builtins-offset-of.cc + (MacroBuiltin::offset_of_handler): Likewise. + * lex/rust-lex.cc (Lexer::dump_and_skip): Likewise. + * ast/rust-ast.h (class Token): Remove dead code. + (Token::has_str): Remove function. + (Token::should_have_str): New function. + * lex/rust-token.cc (Token::get_str): Remove function + definition. + * lex/rust-token.h: Include "rust-diagnostics.h". + (Token::str): Change type from std::unique_ptr to + std::string. + (Token::Token): Adjust initialization of str member variable and + the type of the parameter used to initialize it. + (Token::make_identifier): Accept std::string instead of rvalue + reference to std::string. + (Token::make_int): Likewise. + (Token::make_float): Likewise. + (Token::make_string): Likewise. + (Token::make_byte_string): Likewise. + (Token::make_raw_string): Likewise. + (Token::make_inner_doc_comment): Likewise. + (Token::make_outer_doc_comment): Likewise. + (Token::make_lifetime): Likewise. + (Token::get_str): Add definition to function declaration. + (Token::has_str): Remove member function. + (Token::should_have_str): Handle INNER_DOC_COMMENT and + OUTER_DOC_COMMENT. + +2025-10-30 Owen Avery + + * expand/rust-macro-builtins-format-args.cc + (format_args_parse_arguments): Split format expression parsing + into... + (format_args_parse_expr): ...a new function here, while handling + eager expansion. + (MacroBuiltin::format_args_handler): Use format_args_parse_expr. + +2025-10-30 Owen Avery + + * parse/rust-parse-impl.h (Parser::parse_expr): Avoid skipping + or splitting tokens. + (Parser::null_denotation): Assume initial token was not skipped + and adjust function signature to match. Use + parse_path_in_expression instead of + parse_path_in_expression_pratt and handle SCOPE_RESOLUTION. + (Parser::parse_path_in_expression_pratt): Remove function. + * parse/rust-parse.h (null_denotation): Remove initial token + parameter. + (parse_path_in_expression_pratt): Remove function. + +2025-10-30 Pierre-Emmanuel Patry + + * typecheck/rust-coercion.cc (TypeCoercionRules::do_coercion): Use as + member function. + (TypeCoercionRules::coerce_borrowed_pointer): Likewise. + +2025-10-30 Pierre-Emmanuel Patry + + * typecheck/rust-coercion.cc (TypeCoercionRules::do_coercion): + Move nevertype coercion from here... + (TypeCoercionRules::coerce_never): ... to here. + * typecheck/rust-coercion.h: Add function prototype. + +2025-10-30 Pierre-Emmanuel Patry + + * typecheck/rust-coercion.cc (TypeCoercionRules::do_coercion): Adapt + call to new return type. + (TypeCoercionRules::coerce_unsized): Change error handling. + * typecheck/rust-coercion.h: Update function prototype and add new + CoerceUnsizedError error type. + +2025-10-30 Pierre-Emmanuel Patry + + * typecheck/rust-coercion.cc (TypeCoercionRules::do_coercion): Refactor + common return statement. + +2025-10-30 Pierre-Emmanuel Patry + + * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Remove + unused assignment. + * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_segments): + Likewise. + * typecheck/rust-tyty.cc (ParamType::handle_substitions): Likewise. + * typecheck/rust-unify.cc (UnifyRules::go): Likewise. + +2025-10-30 Pierre-Emmanuel Patry + + * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): + Construct value in place. + +2025-10-30 Pierre-Emmanuel Patry + + * resolve/rust-ast-resolve-stmt.cc (ResolveStmt::visit): Remove + unused copy. + +2025-10-30 Pierre-Emmanuel Patry + + * backend/rust-compile-expr.cc (CompileExpr::generate_closure_fntype): + Unwrap the optional. + * backend/rust-compile.cc: Change return type container. Adapt code to + new return type. + * typecheck/rust-hir-dot-operator.cc: Likewise. + * typecheck/rust-hir-path-probe.cc: Likewise. + * typecheck/rust-hir-type-check-implitem.cc (TypeCheckImplItemWithTrait::visit): + Likewise. + * typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): + Likewise. + * typecheck/rust-tyty-bounds.cc (TypeBoundPredicate::contains_item): + Likewise. + (TypeBoundPredicate::lookup_associated_item): Likewise. + (TypeBoundPredicateItem::get_parent): Likewise. + (TypeBoundPredicate::lookup_associated_type): Likewise. + * typecheck/rust-tyty.cc (BaseType::satisfies_bound): Likewise. + * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::visit): Change + return type. + * typecheck/rust-tyty.h: Likewise. + +2025-10-30 Pierre-Emmanuel Patry + + * typecheck/rust-casts.cc (TypeCastRules::cast_rules): Authorize + cast from function pointer to integer like type. + +2025-10-30 Pierre-Emmanuel Patry + + * typecheck/rust-hir-type-check-base.cc (walk_type_to_constrain): Walk + through all kind of type to collect ty leaves. + +2025-10-30 Pierre-Emmanuel Patry + + * ast/rust-type.h: Prevent reconstruction on null pointers. + +2025-10-30 Owen Avery + + * util/rust-attribute-values.h (Attributes::SIMD_TEST): Remove + static constexpr member variable. + * util/rust-attributes.cc (__definitions): Remove entry for + SIMD_TEST. + +2025-10-30 Owen Avery + + * parse/rust-parse-impl.h (Parser::parse_identifier_pattern): + Use parse_pattern_no_alt to parse identifier pattern + subpatterns. + (Parser::parse_ident_leading_pattern): Likewise. + +2025-10-30 Owen Avery + + * ast/rust-fmt.cc (Pieces::collect): Handle changes to ffi + interface. + (Pieces::~Pieces): Remove function definition. + (Pieces::Pieces): Likewise. + (Pieces::operator=): Likewise. + * ast/rust-fmt.h: Include "optional.h". + (rust_ffi_alloc): New extern "C" function declaration. + (rust_ffi_dealloc): Likewise. + (class FFIVec): New class. + (class FFIOpt): Likewise. + (RustHamster::RustHamster): New constructor accepting const + std::string reference. + (struct FormatSpec): Use FFIOpt. + (struct PieceSlice): Remove struct. + (struct RustString): Likewise. + (struct FormatArgsHandle): Likewise. + (collect_pieces): Change function signature. + (clone_pieces): Likewise. + (destroy_pieces): Remove extern "C" function declaration. + (Pieces::~Pieces): Remove function declaration. + (Pieces::operator=): Likewise. + (Pieces::get_pieces): Handle changes to class fields. + (Pieces::Pieces): Remove copy and move constructor declarations, + adjust signature of remaining constructor declaration. + (Pieces::pieces_vector): Remove member variable. + (Pieces::handle): Likewise. + (Pieces::data): Add member variable. + * expand/rust-macro-builtins-asm.cc (expand_inline_asm_strings): + Use references to avoid copying. + +2025-10-30 lishin + + * backend/rust-compile-pattern.cc (CompilePatternLet::visit): + Handle tuple destructuring containing by-ref. + +2025-10-30 Yap Zhi Heng + + * hir/tree/rust-hir-pattern.h: Add SlicePatternItems base class and + SlicePatternItemsNoRest/SlicePatternItemsHasRest derived classes. + Update SlicePattern to hold patterns using the new classes. + * hir/tree/rust-hir-full-decls.h: Declare new classes. + * hir/tree/rust-hir.cc: Add visits for new classes. + * hir/tree/rust-hir-visitor.h: Add visits for new classes. + * hir/tree/rust-hir-visitor.cc: Implement visits for new classes. + * hir/rust-hir-dump.h: Add visits for new classes. + * hir/rust-hir-dump.cc: Implement Dump::visit for new classes. + * hir/rust-ast-lower-base.h: Declare new lower_slice_pattern_no_rest/has_rest + methods. + * hir/rust-ast-lower-base.cc: Implement lower_slice_pattern_no_rest/has_rest + to lower AST slice pattern items to HIR. + * hir/rust-ast-lower-pattern.cc: Update ASTLoweringPattern::visit for + SlicePattern to use new lowering methods. + * backend/rust-compile-pattern.cc: Update CompilePatternCheckExpr::visit + and CompilePatternBindings::visit for SlicePattern to handle + SlicePatternItemsNoRest/HasRest. + * checks/errors/borrowck/rust-bir-builder-pattern.cc: Update + PatternBindingBuilder::visit for SlicePattern to iterate members correctly. + * checks/errors/borrowck/rust-bir-builder-struct.h: Add visits for new + classes. + * checks/errors/borrowck/rust-function-collector.h: Add visits for new + classes. + * checks/errors/rust-const-checker.h: Add visits for new classes. + * checks/errors/rust-const-checker.cc: Implement empty visits for new classes. + * checks/errors/rust-hir-pattern-analysis.h: Add visits for new classes. + * checks/errors/rust-hir-pattern-analysis.cc: Implement empty visits for new + classes. + * checks/errors/rust-unsafe-checker.h: Add visits for new classes. + * checks/errors/rust-unsafe-checker.cc: Implement empty visits for new + classes. + * typecheck/rust-hir-type-check-pattern.cc: Update TypeCheckPattern::visit + for SlicePattern to handle SlicePatternItemsNoRest/HasRest. + +2025-10-30 Owen Avery + + * rust-session-manager.cc (Session::compile_crate): Collect lang + items after expansion. + +2025-10-30 Ryutaro Okada <1015ryu88@gmail.com> + + * Make-lang.in: Replace old read-only checker with new implementation. + * checks/errors/rust-readonly-check.cc (ReadonlyChecker::ReadonlyChecker): + Replace old read-only checker with new implementation. + * checks/errors/rust-readonly-check.h: + Replace old read-only checker with new implementation. + * rust-session-manager.cc (Session::compile_crate): + Switch to new read-only checker. + * checks/errors/rust-readonly-check2.cc: Removed. + * checks/errors/rust-readonly-check2.h: Removed. + +2025-10-30 Ryutaro Okada <1015ryu88@gmail.com> + + * checks/errors/rust-readonly-check2.cc (ReadonlyChecker::check_variable): + Read-only check if the variable is mutable type. + (ReadonlyChecker::is_mutable_type): Read-only check if the variable is mutable type. + * checks/errors/rust-readonly-check2.h: Read-only check if the variable is mutable type. + +2025-10-30 Yap Zhi Heng + + * typecheck/rust-hir-type-check-pattern.cc(ClosureParamInfer(IdentifierPattern)): + Resolve subpattern types for IdentifierPattern. + +2025-10-30 Yap Zhi Heng + + * backend/rust-compile-pattern.cc(CompilePatternLet::visit(IdentifierPattern)): + Add support for subpatterns. + * backend/rust-compile-var-decl.h(CompileVarDecl::visit(IdentifierPattern)): + Implement compilation for subpatterns. + +2025-10-30 lishin + + * typecheck/rust-hir-dot-operator.cc (MethodResolver::Select): + Skip asserts by checking candidate type and using early-continue. + (MethodResolver::try_select_predicate_candidates): + Skip invalid candidates. + +2025-10-30 lishin + + * rust-gcc.cc (constructor_expression): + Ensure vec_alloc reserves at least one element. + +2025-10-30 Pierre-Emmanuel Patry + + * ast/rust-ast.cc (Attribute::check_cfg_predicate): Emit an error with + empty cfg_attr input. + +2025-10-30 Owen Avery + + * resolve/rust-forever-stack.hxx + (ForeverStack::resolve_segments): Remove usage of optional + reference, allow non-final path segments to resolve to types + even outside the type namespace, and allow resolution to + progress past non-final path segments which resolve to modules. + +2025-10-30 Pierre-Emmanuel Patry + + * parse/rust-parse-impl.h (Parser::parse_stmt_or_expr): Add null check + on parse_macro_invocation_partial call. + * ast/rust-path.cc (Path::convert_to_simple_path): Do not exclude + capitalized "Self". + +2025-10-30 Arthur Cohen + + * ast/rust-ast-fragment.cc (Fragment::is_pattern_fragment): New function. + (Fragment::take_pattern_fragment): Likewise. + (Fragment::assert_single_fragment): Likewise. + * ast/rust-ast-fragment.h: Declare them. + * ast/rust-ast.cc (SingleASTNode::SingleASTNode): Add new constructor for pattern + single AST nodes. + (SingleASTNode::operator=): Handle patterns. + (SingleASTNode::accept_vis): Likewise. + (SingleASTNode::is_error): Likewise. + (SingleASTNode::as_string): Likewise. + * ast/rust-ast.h: Add get_pattern_ptr() functions. + * ast/rust-expr.h: Likewise. + * ast/rust-item.h: Likewise. + * ast/rust-pattern.h: Likewise. + * ast/rust-stmt.h: Likewise. + * expand/rust-expand-visitor.cc (derive_item): Use new API enum values. + (expand_item_attribute): Likewise. + (expand_stmt_attribute): Likewise. + (ExpandVisitor::maybe_expand_pattern): New function. + (ExpandVisitor::expand_closure_params): Handle patterns. + (ExpandVisitor::visit): Add new visitors for patterns and missed exprs. + * expand/rust-expand-visitor.h: Declare them. + * expand/rust-macro-expand.cc (transcribe_pattern): New function. + (transcribe_context): Call it. + * expand/rust-macro-expand.h (struct MacroExpander): New Context type. + +2025-10-30 Arthur Cohen + + * ast/rust-ast.h: Change NodeType to enum class Kind. + * ast/rust-ast-fragment.cc: Use new names. + * ast/rust-ast-fragment.h: Likewise. + * ast/rust-ast.cc (SingleASTNode::SingleASTNode): Likewise. + +2025-10-30 Owen Avery + + * parse/rust-parse-impl.h + (Parser::parse_identifier_or_keyword_token): Record error on + failure. + +2025-10-30 Ryutaro Okada <1015ryu88@gmail.com> + + * resolve/rust-ast-resolve-stmt.h: + Add name resolution processing for discriminant values. + +2025-10-30 Ryutaro Okada <1015ryu88@gmail.com> + + * typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): fix error code + +2025-10-30 Owen Avery + + * expand/rust-cfg-strip.cc: Include "rust-macro-expand.h". + (fails_cfg): Rename to... + (CfgStrip::fails_cfg): ...here and handle test attributes. + (fails_cfg_with_expand): Rename to... + (CfgStrip::fails_cfg_with_expand): ...here and handle test + attributes. + * expand/rust-cfg-strip.h (struct ExpansionCfg): Forward + declare. + (CfgStrip::fails_cfg): New member function. + (CfgStrip::fails_cfg_with_expand): Likewise. + (CfgStrip::CfgStrip): Accept reference to ExpansionCfg. + (CfgStrip::expansion_cfg): New member variable. + * rust-session-manager.cc (Session::expansion): Pass + ExpansionCfg instance to CfgStrip constructor. + +2025-10-30 Pierre-Emmanuel Patry + + * resolve/rust-early-name-resolver-2.0.cc (Early::finalize_rebind_import): + Do not abort on wildcard patterns. + +2025-10-30 Pierre-Emmanuel Patry + + * ast/rust-expr.h: Add const getters to llvm members. + * hir/rust-ast-lower-expr.cc (check_llvm_asm_support): Check llvm_asm + usage validity. + (ASTLoweringExpr::visit): Emit an error message instead of aborting. + +2025-10-30 Pierre-Emmanuel Patry + + * expand/rust-macro-builtins-asm.cc (parse_llvm_clobbers): Expect a + comma between clobbers. + +2025-10-30 Pierre-Emmanuel Patry + + * expand/rust-macro-builtins-asm.cc (parse_asm): Simplify expression. + (parse_llvm_asm): Likewise. + +2025-10-30 Owen Avery + + * ast/rust-ast.h (Stmt::get_node_id): Make virtual. + (Type::get_node_id): Likewise. + (AssociatedItem::get_node_id): New virtual member function. + * ast/rust-expr.h (TypeCastExpr::get_casted_expr_ptr): New + member function. + (TypeCastExpr::get_type_to_cast_to_ptr): Likewise. + (ClosureExprInner::get_definition_expr_ptr): Likewise. + * ast/rust-item.h (TypeAlias::get_node_id): New member function + to override AssociatedItem::get_node_id. + (ConstantItem::get_node_id): Likewise. + * expand/rust-expand-visitor.cc + (ExpandVisitor::maybe_expand_expr): Adjust + macro_invoc_expect_id. + (ExpandVisitor::maybe_expand_type): Likewise and add an overload + for std::unique_ptr. + (ExpandVisitor::visit): Check macro_invoc_expect_id and + generally improve visitors so that the testsuite will still + pass. + * expand/rust-expand-visitor.h (ExpandVisitor::ExpandVisitor): + Initialize member variable macro_invoc_expect_id. + (ExpandVisitor::maybe_expand_type): Add an overload for + std::unique_ptr. + (ExpandVisitor::expand_macro_children): Adjust + macro_invoc_expect_id. + (ExpandVisitor::visit): Add an overload for TypeCastExpr. + (ExpandVisitor::macro_invoc_expect_id): New member variable. + +2025-10-30 lishin + + * backend/rust-compile-pattern.cc (CompilePatternCheckExpr::visit): + Check upper compare operator. + * hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::visit): + Handle lowering of exclusive range pattern. + * hir/tree/rust-hir-pattern.h (class RangePattern): + Add support for exclusive ranges in HIR representation. + +2025-10-30 Owen Avery + + * expand/rust-macro-expand.cc (transcribe_expression): Parse any + outer attributes before parsing an expression. + * parse/rust-parse.h (Parser::parse_outer_attributes): Make + public. + +2025-10-30 Pierre-Emmanuel Patry + + * ast/rust-expr.h (struct TupleClobber): Add constructor. + * backend/rust-compile-context.h (struct fncontext): Likewise. + * typecheck/rust-hir-dot-operator.h: Likewise. + * typecheck/rust-tyty-variance-analysis-private.h (struct Constraint): + Likewise. + * typecheck/rust-unify.h: Likewise. + * ast/rust-ast-builder.cc (Builder::new_lifetime_param): Add memory + reservation and construct in place. + (Builder::new_generic_args): Likewise. + * ast/rust-ast-collector.cc (TokenCollector::newline): Likewise. + (TokenCollector::indentation): Likewise. + (TokenCollector::comment): Likewise. + * ast/rust-desugar-apit.cc: Likewise. + * ast/rust-path.cc (Path::convert_to_simple_path): Likewise. + (TypePath::as_simple_path): Likewise. + * ast/rust-path.h: Likewise. + * backend/rust-compile-type.cc (TyTyResolveCompile::visit): Likewise. + (TyTyResolveCompile::create_dyn_obj_record): Likewise. + * checks/errors/rust-hir-pattern-analysis.cc (Matrix::specialize): + Likewise. + (WitnessMatrix::apply_constructor): Likewise. + (check_match_usefulness): Likewise. + * expand/rust-derive-clone.cc (DeriveClone::clone_fn): Likewise. + * expand/rust-macro-builtins-asm.cc (parse_clobber_abi): Likewise. + * expand/rust-macro-expand.cc (MacroExpander::parse_proc_macro_output): + Likewise. + * hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_generic_args): + Likewise. + (ASTLoweringBase::lower_extern_block): Likewise. + * hir/rust-ast-lower-enumitem.h: Likewise. + * hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Likewise. + * hir/rust-ast-lower-extern.h: Likewise. + * hir/rust-ast-lower-implitem.cc (ASTLowerImplItem::visit): Likewise. + (ASTLowerTraitItem::visit): Likewise. + * hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): Likewise. + * hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::visit): Likewise. + * hir/rust-ast-lower.cc (ASTLowering::go): Likewise. + (ASTLoweringBlock::visit): Likewise. + (ASTLoweringIfLetBlock::desugar_iflet): Likewise. + (ASTLoweringExprWithBlock::visit): Likewise. + (ASTLowerPathInExpression::visit): Likewise. + (ASTLowerQualPathInExpression::visit): Likewise. + * hir/tree/rust-hir.cc (PathPattern::convert_to_simple_path): Likewise. + (TypePath::as_simple_path): Likewise. + * metadata/rust-export-metadata.cc (ExportContext::emit_function): + Likewise. + * parse/rust-parse-impl.h (Parser::parse_decl_macro_def): Likewise. + (Parser::parse_lifetime_params): Likewise. + * resolve/rust-ast-resolve-item.cc (ResolveTraitItems::visit): + Likewise. + (ResolveItem::visit): Likewise. + (flatten_list): Likewise. + * resolve/rust-ast-resolve-pattern.cc (PatternDeclaration::visit): + Likewise. + * typecheck/rust-autoderef.cc (AutoderefCycle::try_autoderefed): + Likewise. + * typecheck/rust-coercion.cc (TypeCoercionRules::coerce_unsized): + Likewise. + * typecheck/rust-hir-dot-operator.cc: Likewise. + * typecheck/rust-hir-path-probe.cc: Likewise. + * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): + Likewise. + * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): + Likewise. + (TypeCheckExpr::resolve_fn_trait_call): Likewise. + * typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::visit): + Likewise. + (TypeCheckImplItem::visit): Likewise. + * typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): + Likewise. + * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): + Likewise. + * typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::resolve): + Likewise. + * typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): + Likewise. + * typecheck/rust-hir-type-check.cc (TraitItemReference::get_type_from_fn): + Likewise. + * typecheck/rust-typecheck-context.cc (TypeCheckContext::push_return_type): + Likewise. + (TypeCheckContext::insert_associated_impl_mapping): Likewise. + * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::scan): Likewise. + (TypeBoundsProbe::add_trait_bound): Likewise. + (TypeBoundPredicate::operator=): Likewise. + (TypeBoundPredicateItem::get_tyty_for_receiver): Likewise. + (TypeBoundPredicate::get_associated_type_items): Likewise. + * typecheck/rust-tyty-call.cc (TypeCheckMethodCallExpr::go): Likewise. + * typecheck/rust-tyty-subst.cc (SubstitutionRef::clone_substs): + Likewise. + (SubstitutionRef::infer_substitions): Likewise. + (SubstitutionRef::are_mappings_bound): Likewise. + * typecheck/rust-tyty-variance-analysis.cc (GenericTyPerCrateCtx::query_generic_variance): + Likewise. + (GenericTyVisitorCtx::add_constraint): Likewise. + * typecheck/rust-tyty.cc (FnPtr::clone): Likewise. + (DynamicObjectType::get_object_items): Likewise. + * typecheck/rust-unify.cc (UnifyRules::Resolve): Likewise. + (UnifyRules::go): Likewise. + (UnifyRules::expect_tuple): Likewise. + * util/rust-canonical-path.h: Likewise. + * util/rust-token-converter.cc (convert): Likewise. + +2025-10-30 Pierre-Emmanuel Patry + + * util/bi-map.h: Add include directive for required declarations. + * util/fnv-hash.h: Likewise. + * util/rust-dump.h: Likewise. + * util/rust-inline-visitor.h: Likewise. + * util/rust-unwrap-segment.h: Likewise. + +2025-10-30 Pierre-Emmanuel Patry + + * util/rust-lang-item.h (RUST_LANG_ITEM_H): Add header guards. + +2025-10-30 Pierre-Emmanuel Patry + + * parse/rust-parse.h: Change class to struct for friend qualification. + +2025-10-30 Pierre-Emmanuel Patry + + * checks/lints/rust-lint-marklive-base.h (RUST_HIR_LIVENESS_BASE): + Remove header includes. + +2025-10-30 Pierre-Emmanuel Patry + + * ast/rust-cond-compilation.h: Delete copy constructor for + ConfigurationAll and ConfigurationAny. + +2025-10-30 Pierre-Emmanuel Patry + + * ast/rust-type.h: Update member instead of parameter + +2025-10-30 Pierre-Emmanuel Patry + + * ast/rust-cond-compilation.h: Move vector instead of passing it by + value. + +2025-10-30 Pierre-Emmanuel Patry + + * ast/rust-pattern.h: Include header directly. + +2025-10-30 Pierre-Emmanuel Patry + + * ast/rust-cond-compilation.h: Copy cfg_attrs + +2025-10-30 Pierre-Emmanuel Patry + + * ast/rust-ast-formatting.h (RUST_AST_FORMATTING_H): Include required + headers directly. + +2025-10-30 Owen Avery + + * util/rust-attributes.cc (Attributes::extract_string_literal): + New function definition. + * util/rust-attributes.h (Attributes::extract_string_literal): + New function declaration. + * ast/rust-collect-lang-items.cc (get_lang_item_attr): Use + extract_string_literal. + * backend/rust-compile-base.cc: Include "rust-attributes.h". + (HIRCompileBase::handle_link_section_attribute_on_fndecl): + Use extract_string_literal. + (HIRCompileBase::handle_must_use_attribute_on_fndecl): Likewise. + * hir/rust-ast-lower-base.cc + (ASTLoweringBase::handle_lang_item_attribute): Likewise. + * rust-session-manager.cc (Session::handle_crate_name): + Likewise. + +2025-10-30 Yap Zhi Heng + + * hir/tree/rust-hir-pattern.h: + - Rename TupleItems to PatternItems. + - Rename TuplePatternItemsMultiple/Ranged & TupleStructItemsRange/NoRange to + TuplePatternItemsNoRest/HasRest and TupleStructItemsNoRest/HasRest. + - Update enum values to NO_REST/HAS_REST. + - Rename clone_tuple_items_impl to clone_pattern_items_impl. + * hir/tree/rust-hir-full-decls.h: Renamed the classes accordingly. + * hir/tree/rust-hir-visitor.h: Renamed the classes accordingly. + * hir/tree/rust-hir-visitor.cc: Renamed the classes accordingly. + * hir/rust-hir-dump.h: Renamed the classes accordingly. + * hir/rust-hir-dump.cc: Renamed the classes accordingly. + * hir/tree/rust-hir.cc: Renamed the classes accordingly. + * hir/rust-ast-lower-base.cc: Renamed the classes accordingly. + * hir/rust-ast-lower-pattern.cc: Renamed the classes accordingly. + * backend/rust-compile-pattern.cc: Renamed the classes accordingly. + * backend/rust-compile-var-decl.h: Renamed the classes accordingly. + * checks/errors/borrowck/rust-bir-builder-pattern.cc: Renamed the classes accordingly. + * checks/errors/borrowck/rust-bir-builder-struct.h: Renamed the classes accordingly. + * checks/errors/borrowck/rust-function-collector.h: Renamed the classes accordingly. + * checks/errors/rust-const-checker.cc: Renamed the classes accordingly. + * checks/errors/rust-const-checker.h: Renamed the classes accordingly. + * checks/errors/rust-hir-pattern-analysis.cc: Renamed the classes accordingly. + * checks/errors/rust-hir-pattern-analysis.h: Renamed the classes accordingly. + * checks/errors/rust-unsafe-checker.cc: Renamed the classes accordingly. + * checks/errors/rust-unsafe-checker.h: Renamed the classes accordingly. + * checks/errors/rust-readonly-check2.cc: Renamed the classes accordingly. + * typecheck/rust-hir-type-check-pattern.cc: Update references to renamed classes and enum + values. + +2025-10-30 Pierre-Emmanuel Patry + + * expand/rust-derive-eq.cc: Use empty vector explicitly. + 2025-08-05 Ryutaro Okada <1015ryu88@gmail.com> * Make-lang.in (rust-readonly-check2.cc): diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 844176ef78d2..daf99d1a8a82 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,1277 @@ +2025-10-30 Yap Zhi Heng + + * rust/compile/tuplepattern-restpattern-typecheck-err.rs: New file. + +2025-10-30 Ryo Yoshida + + * rust/compile/match-tuplestructpattern-non-variant.rs: New test. + +2025-10-30 Yap Zhi Heng + + * rust/compile/issue-4231.rs: New file. + +2025-10-30 Lucas Ly Ba + + * rust/compile/issue-4212.rs: New test. + +2025-10-30 lishin + + * rust/compile/issue-3556.rs: New test. + +2025-10-30 Ryo Yoshida + + * rust/compile/tuple_index_on_non_tuple.rs: New test. + +2025-10-30 0xllx0 + + * rust/compile/issue-4145.rs: New test. + +2025-10-30 Pierre-Emmanuel Patry + + * rust/compile/attr_malformed_doc.rs: New test. + +2025-10-30 Pierre-Emmanuel Patry + + * rust/compile/attr_malformed_path.rs: New test. + +2025-10-30 Yap Zhi Heng + + * rust/compile/match-tuplestructpattern-err.rs: New file. + +2025-10-30 Yap Zhi Heng + + * rust/compile/match-tuplestructpattern-rest.rs: New file. + * rust/execute/torture/match-tuplestructpattern-rest-1.rs: New file. + * rust/execute/torture/match-tuplestructpattern-rest-2.rs: New file. + +2025-10-30 0xllx0 + + * rust/compile/issue-4148.rs: New test. + +2025-10-30 Owen Avery + + * rust/core/core.exp: New test. + +2025-10-30 Yap Zhi Heng + + * rust/compile/issue-3929-1.rs: New file. + * rust/compile/issue-3929-2.rs: New file. + +2025-10-30 Owen Avery + + * rust/execute/torture/link-name.rs: New test. + +2025-10-30 Pierre-Emmanuel Patry + + * rust/compile/macros/mbe/macro58.rs: New test. + +2025-10-30 Philip Herron + + * rust/compile/issue-3538.rs: New test. + +2025-10-30 Philip Herron + + * rust/compile/issue-3592.rs: New test. + +2025-10-30 Philip Herron + + * rust/compile/issue-4165.rs: New test. + +2025-10-30 Philip Herron + + * rust/compile/issue-4090-1.rs: New test. + * rust/compile/issue-4090-2.rs: New test. + +2025-10-30 Philip Herron + + * rust/compile/issue-4168.rs: New test. + +2025-10-30 Philip Herron + + * rust/compile/issue-2394.rs: Update test case + * rust/compile/issue-4146.rs: New test. + +2025-10-30 Philip Herron + + * rust/compile/issue-4139.rs: New test. + +2025-10-30 Owen Avery + + * rust/compile/issue-4155.rs: New test. + +2025-10-30 Pierre-Emmanuel Patry + + * rust/compile/issue-3922.rs: New test. + +2025-10-30 Pierre-Emmanuel Patry + + * rust/compile/issue-3924.rs: New test. + +2025-10-30 Philip Herron + + * rust/compile/issue-3969.rs: New test. + +2025-10-30 Philip Herron + + * rust/compile/issue-3965-1.rs: New test. + * rust/compile/issue-3965-2.rs: New test. + +2025-10-30 Yap Zhi Heng + + * rust/compile/tuplepattern-rest-readonly.rs: New file. + +2025-10-30 Yap Zhi Heng + + * rust/compile/issue-3930.rs: New file. + +2025-10-30 Philip Herron + + * rust/compile/issue-1725-2.rs: remove bad error message + +2025-10-30 Pierre-Emmanuel Patry + + * rust/compile/use_self_alone_in_list.rs: New test. + +2025-10-30 Pierre-Emmanuel Patry + + * rust/compile/use_self_alone.rs: New test. + +2025-10-30 Owen Avery + + * rust/compile/primitive-import.rs: New test. + +2025-10-30 Owen Avery + + * rust/compile/parse_float_dot.rs: New test. + +2025-10-30 Owen Avery + + * rust/compile/format_args_concat.rs: New test. + +2025-10-30 Owen Avery + + * rust/compile/global-path-array.rs: New test. + +2025-10-30 Pierre-Emmanuel Patry + + * rust/compile/impl_fnptr.rs: New test. + +2025-10-30 Owen Avery + + * rust/compile/parse_closure_bind.rs: New test. + +2025-10-30 lishin + + * rust/compile/issue-3645.rs: New test. + +2025-10-30 Yap Zhi Heng + + * rust/compile/slice_rest_pattern.rs: Removed -fsyntax-only. + * rust/execute/torture/match-slicepattern-array-2.rs: New file. + * rust/execute/torture/match-slicepattern-slice-2.rs: New file. + +2025-10-30 Yap Zhi Heng + + * rust/execute/torture/let-identifierpattern-subpattern.rs: New file. + +2025-10-30 lishin + + * rust/compile/issue-3958.rs: New test. + +2025-10-30 lishin + + * rust/compile/issue-3947.rs: New test. + +2025-10-30 Pierre-Emmanuel Patry + + * rust/compile/issue-3966.rs: New test. + +2025-10-30 Owen Avery + + * rust/compile/use_3.rs: New test. + +2025-10-30 Pierre-Emmanuel Patry + + * rust/compile/issue-3974.rs: New test. + +2025-10-30 Arthur Cohen + + * rust/compile/issue-3726.rs: New test. + * rust/compile/issue-3898.rs: New test. + +2025-10-30 Owen Avery + + * rust/compile/macros/mbe/macro-issue4054.rs: New test. + +2025-10-30 Ryutaro Okada <1015ryu88@gmail.com> + + * rust/compile/enum_discriminant3.rs: New test. + +2025-10-30 Owen Avery + + * rust/compile/cfg-test.rs: New test. + +2025-10-30 Pierre-Emmanuel Patry + + * rust/compile/import_wildcards.rs: New test. + +2025-10-30 Owen Avery + + * rust/compile/macros/mbe/macro49.rs: Add missing lang items. + +2025-10-30 lishin + + * rust/compile/issue-3928.rs: New test. + +2025-10-30 Pierre-Emmanuel Patry + + * rust/execute/inline_asm_inout_ident.rs: Add arch filter on test. + * rust/execute/inline_asm_inout_var.rs: Likewise. + +2025-10-30 Owen Avery + + * rust/compile/attr-macro.rs: New test. + +2025-10-30 David Faust + + PR debug/122248 + * gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-4.c: New. + * gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-5.c: New. + * gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-6.c: New. + +2025-10-30 David Faust + + * gcc.dg/debug/btf/btf-prune-4.c: New. + +2025-10-30 Eric Botcazou + + * gcc.dg/cpp/escape-3.i: Remove parentheses in dg-scan directive. + +2025-10-30 Qing Zhao + + * gcc.dg/pointer-counted-by.c: Update for void pointers. + * gcc.dg/pointer-counted-by-10.c: New test. + * gcc.dg/pointer-counted-by-4-void.c: New test. + +2025-10-30 Andrew Pinski + + PR target/116075 + * gcc.target/aarch64/sve/dup-insr-1.c: New test. + * gcc.target/aarch64/sve/dup-insr-2.c: New test. + +2025-10-30 Andrew Pinski + + PR tree-optimization/122247 + * g++.dg/tree-ssa/copy-prop-aggregate-sra-2.C: New test. + +2025-10-30 Andrew Pinski + + PR tree-optimization/122247 + * g++.dg/tree-ssa/copy-prop-aggregate-sra-1.C: New test. + +2025-10-30 Robin Dapp + + * gcc.dg/tree-ssa/ctz-char.c: Remove -fno-tree-ch. + * gcc.dg/tree-ssa/ctz-complement-char.c: Ditto. + * gcc.dg/tree-ssa/ctz-complement-int.c: Ditto. + * gcc.dg/tree-ssa/ctz-complement-long-long.c: Ditto. + * gcc.dg/tree-ssa/ctz-complement-long.c: Ditto. + * gcc.dg/tree-ssa/ctz-int.c: Ditto. + * gcc.dg/tree-ssa/ctz-long-long.c: Ditto. + * gcc.dg/tree-ssa/ctz-long.c: Ditto. + * gcc.dg/tree-ssa/ctz-ch.c: New test. + * gcc.dg/pr41488.c: Add -fno-tree-scev-cprop. + +2025-10-30 Eric Botcazou + + * gnat.dg/specs/generic_inst7.ads: New test. + * gnat.dg/specs/generic_inst8.ads: New test. + +2025-10-30 Robin Dapp + + PR target/122445 + * gcc.target/riscv/rvv/autovec/pr122445.c: New test. + +2025-10-30 Artemiy Volkov + + PR tree-optimization/122478 + * gcc.dg/tree-ssa/pr122478.c: New test. + +2025-10-30 Richard Biener + + * gcc.dg/tree-ssa/pr92834.c: Scan phiopt1 instead of optimized. + +2025-10-30 Stefan Schulze Frielinghaus + + PR rtl-optimization/121198 + * gcc.target/avr/pr121198.c: New test. + +2025-10-30 Gaius Mulley + + PR modula2/122485 + * gm2.dg/spell/iso/fail/badimport.mod: New test. + +2025-10-30 Richard Biener + Eric Botcazou + + * gcc.dg/vect/slp-reduc-13.c: New testcase. + +2025-10-30 Uros Bizjak + + PR target/116815 + * gcc.dg/pr116815.c: New test. + * gcc.target/i386/pr116815.c: New test. + +2025-10-30 Andrew Pinski + + * c-c++-common/ubsan/align-5.c: Xfail. + * gcc.dg/pr107389.c: Move to... + * gcc.dg/torture/pr107389.c: ...here. Skip for lto. + * gcc.dg/builtin-assume-aligned-1.c: Instead of + testing for deleting of assume-align, test for + the alignment/misalignment. Also disable the + vectorizer. + +2025-10-30 Andrew Pinski + + Revert: + 2025-10-30 Andrew Pinski + + PR middle-end/107389 + PR tree-optimization/122086 + * gcc.dg/pr107389.c: Move to... + * gcc.dg/torture/pr107389.c: ...here. Skip for lto. + Use dg-additional-options rather than dg-options. + * c-c++-common/ubsan/align-5.c: xfail. + +2025-10-30 liuhongt + + * gcc.target/i386/pr122457.c: New test. + +2025-10-30 Guo Jie + + * gcc.target/loongarch/fnmam4-vec.c: New test. + +2025-10-30 Jinyang He + Peng Fan + + * gcc.target/loongarch/conditional-move-opt-1.c: Remove mul. + * gcc.target/loongarch/conditional-move-opt-2.c: Remove and. + * gcc.target/loongarch/conditional-move-opt-3.c: New test. + +2025-10-30 Eric Botcazou + + * gnat.dg/aggr32.adb: New test. + * gnat.dg/aggr32_pkg.ads: New helper. + * gnat.dg/aggr32_pkg-child.ads: Likewise. + +2025-10-30 Eric Botcazou + + * gnat.dg/specs/generic_inst6.ads: New test. + * gnat.dg/specs/generic_inst6_pkg1-child.ads: New helper. + * gnat.dg/specs/generic_inst6_pkg1-child-grand1.ads: Likewise. + * gnat.dg/specs/generic_inst6_pkg1-child-grand2.ads: Likewise. + * gnat.dg/specs/generic_inst6_pkg1.ads: Likewise. + * gnat.dg/specs/generic_inst6_pkg2.ads: Likewise. + * gnat.dg/specs/generic_inst6_pkg3.ads: Likewise. + +2025-10-29 Andrew MacLeod + + PR tree-optimization/91191 + * gcc.dg/pr91191.c: New. + +2025-10-29 Paul Thomas + + PR fortran/122165 + * gfortran.dg/pdt_64.f03: New test. + +2025-10-29 Richard Biener + + PR tree-optimization/70102 + * gfortran.dg/vect/pr70102.f: New testcase. + +2025-10-29 Paul Thomas + + PR fortran/122433 + PR fortran/122434 + * gfortran.dg/pdt_62.f03: New test. + * gfortran.dg/pdt_63.f03: New test. + +2025-10-29 Lulu Cheng + + PR target/122097 + * gcc.target/loongarch/pr122097.c: New test. + +2025-10-29 Xi Ruoyao + + * gcc.target/loongarch/trap-default.c: New test. + * gcc.target/loongarch/trap-1.c: New test. + +2025-10-28 Yuao Ma + + PR fortran/122342 + * gfortran.dg/coarray_atomic_5.f90: Update testcase. + * gfortran.dg/team_form_3.f90: Likewise. + +2025-10-28 Artemiy Volkov + + * gcc.dg/tree-ssa/forwprop-42.c: New test. + +2025-10-28 Eric Botcazou + + * gnat.dg/specs/generic_inst5.ads: New test. + * gnat.dg/specs/generic_inst5_pkg1.ads: New helper. + * gnat.dg/specs/generic_inst5_pkg2.ads: Likewise. + +2025-10-28 Eric Botcazou + + * gnat.dg/specs/generic_inst4-child2.ads: New test. + * gnat.dg/specs/generic_inst4.ads: New helper. + * gnat.dg/specs/generic_inst4-child1.ads: Likewise. + +2025-10-28 Eric Botcazou + + * gnat.dg/specs/generic_inst3.ads: Add dg-do directive. + +2025-10-27 Nathaniel Shead + + PR c++/122422 + * g++.dg/modules/merge-20.h: New test. + * g++.dg/modules/merge-20_a.H: New test. + * g++.dg/modules/merge-20_b.C: New test. + +2025-10-27 Nathaniel Shead + + PR c++/122310 + * g++.dg/modules/lambda-12.h: New test. + * g++.dg/modules/lambda-12_a.H: New test. + * g++.dg/modules/lambda-12_b.C: New test. + +2025-10-27 Andrew Pinski + + PR tree-optimization/105749 + PR tree-optimization/80635 + * g++.dg/warn/pr80635-3.C: New test. + * g++.dg/warn/pr80635-4.C: New test. + +2025-10-27 H.J. Lu + + PR c/122427 + * g++.target/i386/cf_check-1.C: New test. + * g++.target/i386/cf_check-2.C: Likewise. + * g++.target/i386/cf_check-3.C: Likewise. + * g++.target/i386/cf_check-4.C: Likewise. + * gcc.target/i386/cf_check-7.c: Likewise. + * gcc.target/i386/cf_check-8.c: Likewise. + * gcc.target/i386/cf_check-9.c: Likewise. + * gcc.target/i386/cf_check-10.c: Likewise. + * gcc.target/i386/cf_check-11.c: Likewise. + * gcc.target/i386/no-callee-saved-12.c: Remove dg-error. + * gcc.target/i386/preserve-none-17.c: Likewise. + +2025-10-27 Eric Botcazou + + * gnat.dg/specs/private3-child.ads: New test. + * gnat.dg/specs/private3.ads: New helper. + +2025-10-27 Eric Botcazou + + * gnat.dg/specs/generic_inst3.ads: New test. + * gnat.dg/specs/generic_inst3_pkg1.ads: New helper. + * gnat.dg/specs/generic_inst3_pkg1.adb: New helper. + * gnat.dg/specs/generic_inst3_pkg2.ads: Likewise. + * gnat.dg/specs/generic_inst3_pkg3.ads: Likewise. + * gnat.dg/specs/generic_inst3_pkg3-child.ads: Likewise. + +2025-10-27 Tamar Christina + + PR tree-optimization/122408 + * gfortran.target/aarch64/pr122408_1.f90: New test. + * gfortran.target/aarch64/pr122408_2.f90: New test. + +2025-10-27 Jakub Jelinek + + PR tree-optimization/122394 + * g++.dg/opt/pr122394.C: New test. + +2025-10-27 Olivier Hainque + + * g++.target/riscv/rvv/xtheadvector/pr116593.C: Skip if !hostedlib. + +2025-10-27 Paul Thomas + + PR fortran/95541 + * gfortran.dg/pdt_61.f03: New test. + +2025-10-27 Andrew MacLeod + + PR tree-optimization/111003 + * gcc.dg/tree-ssa/pr111003.c: XFAIL. + +2025-10-27 Richard Biener + + PR middle-end/122325 + * gcc.dg/complex-8.c: New testcase. + * gcc.dg/complex-9.c: Likewise. + +2025-10-27 Kito Cheng + + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_128bit_vector.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_256bit_vector.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_32bit_vector.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_64bit_vector.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_all_mixed.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_call_mixed_function.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_different_vector_elements.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_different_vectors_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_different_width_vectors_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_equivalent_struct.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_four_registers.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_fp_vs_int_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_large_vector_small_abi_vlen.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_mixed_args.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_mixed_float_vector.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_mixed_int_vector.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_mixed_struct.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_mixed_struct_advanced.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_mixed_vector_types_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_multiple_unions.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_multiple_vectors.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_multiple_with_small_abi_vlen.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_register_exhaustion.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_register_exhaustion_mixed.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_register_pressure_scenarios.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_same_vectors_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_simple_union.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_single_register.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_single_vector_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_struct_different_abi_vlen.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_struct_eight_128bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_struct_five_256bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_struct_four_256bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_struct_nine_128bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_two_registers.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-32/test_vector_array_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_128bit_vector.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_256bit_vector.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_32bit_vector.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_64bit_vector.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_all_mixed.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_call_mixed_function.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_different_vector_elements.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_different_vectors_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_different_width_vectors_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_equivalent_struct.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_four_registers.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_fp_vs_int_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_large_vector_small_abi_vlen.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_mixed_args.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_mixed_float_vector.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_mixed_int_vector.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_mixed_struct.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_mixed_struct_advanced.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_mixed_vector_types_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_multiple_unions.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_multiple_vectors.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_multiple_with_small_abi_vlen.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_register_exhaustion.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_register_exhaustion_mixed.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_register_pressure_scenarios.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_same_vectors_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_simple_union.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_single_register.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_single_vector_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_struct_different_abi_vlen.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_struct_eight_128bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_struct_five_256bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_struct_four_256bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_struct_nine_128bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_two_registers.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-32-xlen-64/test_vector_array_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_128bit_vector.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_256bit_vector.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_32bit_vector.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_64bit_vector.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_all_mixed.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_call_mixed_function.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_different_vector_elements.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_different_vectors_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_different_width_vectors_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_equivalent_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_four_registers.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_fp_vs_int_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_large_vector_small_abi_vlen.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_mixed_args.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_mixed_float_vector.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_mixed_int_vector.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_mixed_struct.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_mixed_struct_advanced.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_mixed_vector_types_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_multiple_unions.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_multiple_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_multiple_with_small_abi_vlen.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_register_exhaustion.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_register_exhaustion_mixed.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_register_pressure_scenarios.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_same_vectors_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_simple_union.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_single_register.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_single_vector_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_struct_different_abi_vlen.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_struct_eight_128bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_struct_five_256bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_struct_four_256bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_struct_nine_128bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_two_registers.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-32/test_vector_array_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_128bit_vector.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_256bit_vector.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_32bit_vector.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_64bit_vector.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_all_mixed.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_call_mixed_function.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_different_vector_elements.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_different_vectors_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_different_width_vectors_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_equivalent_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_four_registers.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_fp_vs_int_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_large_vector_small_abi_vlen.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_mixed_args.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_mixed_float_vector.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_mixed_int_vector.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_mixed_struct.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_mixed_struct_advanced.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_mixed_vector_types_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_multiple_unions.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_multiple_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_multiple_with_small_abi_vlen.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_register_exhaustion.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_register_exhaustion_mixed.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_register_pressure_scenarios.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_same_vectors_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_simple_union.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_single_register.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_single_vector_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_struct_different_abi_vlen.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_struct_eight_128bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_struct_five_256bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_struct_four_256bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_struct_nine_128bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_two_registers.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-512-xlen-64/test_vector_array_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_128bit_vector.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_256bit_vector.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_32bit_vector.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_64bit_vector.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_all_mixed.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_call_mixed_function.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_different_vector_elements.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_different_vectors_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_different_width_vectors_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_equivalent_struct.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_four_registers.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_fp_vs_int_vectors.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_large_vector_small_abi_vlen.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_mixed_args.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_mixed_float_vector.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_mixed_int_vector.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_mixed_struct.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_mixed_struct_advanced.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_mixed_vector_types_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_multiple_unions.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_multiple_vectors.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_multiple_with_small_abi_vlen.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_register_exhaustion.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_register_exhaustion_mixed.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_register_pressure_scenarios.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_same_vectors_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_simple_union.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_single_register.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_single_vector_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_struct_different_abi_vlen.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_struct_eight_128bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_struct_five_256bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_struct_four_256bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_struct_nine_128bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_two_registers.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-32/test_vector_array_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_128bit_vector.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_256bit_vector.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_32bit_vector.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_64bit_vector.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_all_mixed.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_call_mixed_function.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_different_vector_elements.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_different_vectors_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_different_width_vectors_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_equivalent_struct.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_four_registers.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_fp_vs_int_vectors.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_large_vector_small_abi_vlen.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_mixed_args.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_mixed_float_vector.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_mixed_int_vector.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_mixed_struct.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_mixed_struct_advanced.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_mixed_vector_types_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_multiple_unions.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_multiple_vectors.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_multiple_with_small_abi_vlen.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_register_exhaustion.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_register_exhaustion_mixed.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_register_pressure_scenarios.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_same_vectors_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_simple_union.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_single_register.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_single_vector_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_struct_different_abi_vlen.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_struct_eight_128bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_struct_five_256bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_struct_four_256bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_struct_nine_128bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_two_registers.c: New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-64-xlen-64/test_vector_array_struct.c: + New test. + +2025-10-27 Kito Cheng + + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_128bit_vector.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_256bit_vector.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_32bit_vector.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_64bit_vector.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_all_mixed.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_call_mixed_function.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_different_vector_elements.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_different_vectors_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_different_width_vectors_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_equivalent_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_four_registers.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_fp_vs_int_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_large_vector_small_abi_vlen.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_mixed_args.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_mixed_float_vector.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_mixed_int_vector.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_mixed_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_mixed_struct_advanced.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_mixed_vector_types_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_multiple_unions.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_multiple_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_multiple_with_small_abi_vlen.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_register_exhaustion.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_register_exhaustion_mixed.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_register_pressure_scenarios.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_same_vectors_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_simple_union.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_single_register.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_single_vector_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_struct_different_abi_vlen.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_struct_eight_128bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_struct_five_256bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_struct_four_256bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_struct_nine_128bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_two_registers.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-32/test_vector_array_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_128bit_vector.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_256bit_vector.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_32bit_vector.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_64bit_vector.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_all_mixed.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_call_mixed_function.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_different_vector_elements.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_different_vectors_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_different_width_vectors_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_equivalent_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_four_registers.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_fp_vs_int_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_large_vector_small_abi_vlen.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_mixed_args.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_mixed_float_vector.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_mixed_int_vector.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_mixed_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_mixed_struct_advanced.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_mixed_vector_types_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_multiple_unions.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_multiple_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_multiple_with_small_abi_vlen.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_register_exhaustion.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_register_exhaustion_mixed.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_register_pressure_scenarios.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_same_vectors_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_simple_union.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_single_register.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_single_vector_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_struct_different_abi_vlen.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_struct_eight_128bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_struct_five_256bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_struct_four_256bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_struct_nine_128bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_two_registers.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-128-xlen-64/test_vector_array_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_128bit_vector.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_256bit_vector.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_32bit_vector.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_64bit_vector.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_all_mixed.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_call_mixed_function.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_different_vector_elements.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_different_vectors_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_different_width_vectors_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_equivalent_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_four_registers.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_fp_vs_int_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_large_vector_small_abi_vlen.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_mixed_args.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_mixed_float_vector.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_mixed_int_vector.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_mixed_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_mixed_struct_advanced.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_mixed_vector_types_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_multiple_unions.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_multiple_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_multiple_with_small_abi_vlen.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_register_exhaustion.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_register_exhaustion_mixed.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_register_pressure_scenarios.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_same_vectors_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_simple_union.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_single_register.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_single_vector_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_struct_different_abi_vlen.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_struct_eight_128bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_struct_five_256bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_struct_four_256bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_struct_nine_128bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_two_registers.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-32/test_vector_array_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_128bit_vector.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_256bit_vector.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_32bit_vector.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_64bit_vector.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_all_mixed.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_call_mixed_function.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_different_vector_elements.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_different_vectors_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_different_width_vectors_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_equivalent_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_four_registers.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_fp_vs_int_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_large_vector_small_abi_vlen.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_mixed_args.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_mixed_float_vector.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_mixed_int_vector.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_mixed_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_mixed_struct_advanced.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_mixed_vector_types_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_multiple_unions.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_multiple_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_multiple_with_small_abi_vlen.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_register_exhaustion.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_register_exhaustion_mixed.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_register_pressure_scenarios.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_same_vectors_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_simple_union.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_single_register.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_single_vector_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_struct_different_abi_vlen.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_struct_eight_128bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_struct_five_256bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_struct_four_256bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_struct_nine_128bit_vectors.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_two_registers.c: + New test. + * gcc.target/riscv/rvv/vls-cc/abi-vlen-256-xlen-64/test_vector_array_struct.c: + New test. + * gcc.target/riscv/rvv/vls-cc/common/test_128bit_vector.h: New test. + * gcc.target/riscv/rvv/vls-cc/common/test_256bit_vector.h: New test. + * gcc.target/riscv/rvv/vls-cc/common/test_32bit_vector.h: New test. + * gcc.target/riscv/rvv/vls-cc/common/test_64bit_vector.h: New test. + * gcc.target/riscv/rvv/vls-cc/common/test_all_mixed.h: New test. + * gcc.target/riscv/rvv/vls-cc/common/test_call_mixed_function.h: + New test. + * gcc.target/riscv/rvv/vls-cc/common/test_different_vector_elements.h: + New test. + * gcc.target/riscv/rvv/vls-cc/common/test_different_vectors_struct.h: + New test. + * gcc.target/riscv/rvv/vls-cc/common/test_different_width_vectors_struct.h: + New test. + * gcc.target/riscv/rvv/vls-cc/common/test_equivalent_struct.h: New test. + * gcc.target/riscv/rvv/vls-cc/common/test_four_registers.h: New test. + * gcc.target/riscv/rvv/vls-cc/common/test_fp_vs_int_vectors.h: New test. + * gcc.target/riscv/rvv/vls-cc/common/test_large_vector_small_abi_vlen.h: + New test. + * gcc.target/riscv/rvv/vls-cc/common/test_mixed_args.h: New test. + * gcc.target/riscv/rvv/vls-cc/common/test_mixed_float_vector.h: New test. + * gcc.target/riscv/rvv/vls-cc/common/test_mixed_int_vector.h: New test. + * gcc.target/riscv/rvv/vls-cc/common/test_mixed_struct.h: New test. + * gcc.target/riscv/rvv/vls-cc/common/test_mixed_struct_advanced.h: + New test. + * gcc.target/riscv/rvv/vls-cc/common/test_mixed_vector_types_struct.h: + New test. + * gcc.target/riscv/rvv/vls-cc/common/test_multiple_unions.h: New test. + * gcc.target/riscv/rvv/vls-cc/common/test_multiple_vectors.h: New test. + * gcc.target/riscv/rvv/vls-cc/common/test_multiple_with_small_abi_vlen.h: + New test. + * gcc.target/riscv/rvv/vls-cc/common/test_register_exhaustion.h: + New test. + * gcc.target/riscv/rvv/vls-cc/common/test_register_exhaustion_mixed.h: + New test. + * gcc.target/riscv/rvv/vls-cc/common/test_register_pressure_scenarios.h: + New test. + * gcc.target/riscv/rvv/vls-cc/common/test_same_vectors_struct.h: + New test. + * gcc.target/riscv/rvv/vls-cc/common/test_simple_union.h: New test. + * gcc.target/riscv/rvv/vls-cc/common/test_single_register.h: New test. + * gcc.target/riscv/rvv/vls-cc/common/test_single_vector_struct.h: + New test. + * gcc.target/riscv/rvv/vls-cc/common/test_struct_different_abi_vlen.h: + New test. + * gcc.target/riscv/rvv/vls-cc/common/test_struct_eight_128bit_vectors.h: + New test. + * gcc.target/riscv/rvv/vls-cc/common/test_struct_five_256bit_vectors.h: + New test. + * gcc.target/riscv/rvv/vls-cc/common/test_struct_four_256bit_vectors.h: + New test. + * gcc.target/riscv/rvv/vls-cc/common/test_struct_nine_128bit_vectors.h: + New test. + * gcc.target/riscv/rvv/vls-cc/common/test_two_registers.h: New test. + * gcc.target/riscv/rvv/vls-cc/common/test_vector_array_struct.h: New test. + * gcc.target/riscv/rvv/vls-cc/riscv-vls-cc.exp: New test. + * gcc.target/riscv/rvv/vls-cc/test_128_abi_vlen_large_vector.c: + New test. + * gcc.target/riscv/rvv/vls-cc/test_128_abi_vlen_medium_vector.c: + New test. + * gcc.target/riscv/rvv/vls-cc/test_256_abi_vlen_large_vector.c: + New test. + * gcc.target/riscv/rvv/vls-cc/test_256_abi_vlen_very_large_vector.c: + New test. + * gcc.target/riscv/rvv/vls-cc/test_32_abi_vlen_medium_vector.c: + New test. + * gcc.target/riscv/rvv/vls-cc/test_32_abi_vlen_small_vector.c: New test. + * gcc.target/riscv/rvv/vls-cc/test_64_abi_vlen_medium_vector.c: + New test. + * gcc.target/riscv/rvv/vls-cc/test_64_abi_vlen_small_vector.c: New test. + * gcc.target/riscv/rvv/vls-cc/vls-cc-common.h: New test. + +2025-10-27 Jeff Law + + PR target/64345 + PR tree-optimization/80770 + * gcc.target/riscv/pr120553-2.c: Update expected output. + * gcc.target/riscv/pr64345.c: New test. + * gcc.target/riscv/zbb-andn-orn-01.c: Skip when peephole2 isn't run. + * gcc.target/riscv/zbb-andn-orn-02.c: Likewise. + +2025-10-27 Richard Biener + + PR tree-optimization/122419 + * gcc.dg/vect/pr122419.c: New testcase. + +2025-10-27 Richard Biener + + PR tree-optimization/122435 + * gcc.dg/tree-ssa/ssa-fre-111.c: New testcase. + +2025-10-27 H.J. Lu + + PR target/122323 + * gcc.target/i386/builtin-copysign-8b.c: Add -mtune=generic. + +2025-10-27 Guo Jie + + * gcc.target/loongarch/widen-mul-rtx-cost-signed.c: New test. + * gcc.target/loongarch/widen-mul-rtx-cost-unsigned.c: New test. + +2025-10-27 Guo Jie + + * gcc.target/loongarch/compare-both-non-zero.c: New test. + +2025-10-27 Guo Jie + + * gcc.target/loongarch/sign_extend_ashift.c: New test. + +2025-10-27 Takayuki 'January June' Suwa + + * gcc.target/xtensa/one_cmpl_abs.c: Remove. + +2025-10-27 Andrew Pinski + + PR middle-end/107389 + PR tree-optimization/122086 + * gcc.dg/pr107389.c: Move to... + * gcc.dg/torture/pr107389.c: ...here. Skip for lto. + Use dg-additional-options rather than dg-options. + * c-c++-common/ubsan/align-5.c: xfail. + 2025-10-26 Andrew Pinski PR target/122270 diff --git a/gcc/testsuite/g++.dg/modules/lambda-12.h b/gcc/testsuite/g++.dg/modules/lambda-12.h new file mode 100644 index 000000000000..4dd329d47605 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/lambda-12.h @@ -0,0 +1,27 @@ +// PR c++/122310 +struct Foo { + constexpr static inline auto do_nothing = [](auto && ...){}; + using TNothing = decltype(do_nothing); +}; + +template +struct X { + struct Inner { + union MoreInner { + static constexpr auto x = []{}; +#if __cplusplus >= 202002L + static decltype([]{}) y; +#endif + }; + }; + + using A = decltype(Inner::MoreInner::x); +#if __cplusplus >= 202002L + using B = decltype(Inner::MoreInner::y); +#endif +}; + +inline X::A* a{}; +#if __cplusplus >= 202002L +inline X::B* b{}; +#endif diff --git a/gcc/testsuite/g++.dg/modules/lambda-12_a.H b/gcc/testsuite/g++.dg/modules/lambda-12_a.H new file mode 100644 index 000000000000..83f5d150367f --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/lambda-12_a.H @@ -0,0 +1,5 @@ +// PR c++/122310 +// { dg-additional-options "-fmodule-header" } +// { dg-module-cmi {} } + +#include "lambda-12.h" diff --git a/gcc/testsuite/g++.dg/modules/lambda-12_b.C b/gcc/testsuite/g++.dg/modules/lambda-12_b.C new file mode 100644 index 000000000000..c24d9398a45d --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/lambda-12_b.C @@ -0,0 +1,5 @@ +// PR c++/122310 +// { dg-additional-options "-fmodules -fno-module-lazy" } + +#include "lambda-12.h" +import "lambda-12_a.H"; diff --git a/gcc/testsuite/g++.dg/modules/merge-20.h b/gcc/testsuite/g++.dg/modules/merge-20.h new file mode 100644 index 000000000000..c169d110fabc --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/merge-20.h @@ -0,0 +1,5 @@ +// PR c++/122422 +template struct Type { + constexpr static int arr[] = { 42, 43, 44 }; +}; +inline Type tt; diff --git a/gcc/testsuite/g++.dg/modules/merge-20_a.H b/gcc/testsuite/g++.dg/modules/merge-20_a.H new file mode 100644 index 000000000000..2fca74b244d8 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/merge-20_a.H @@ -0,0 +1,5 @@ +// PR c++/122422 +// { dg-additional-options "-fmodule-header" } +// { dg-module-cmi {} } + +#include "merge-20.h" diff --git a/gcc/testsuite/g++.dg/modules/merge-20_b.C b/gcc/testsuite/g++.dg/modules/merge-20_b.C new file mode 100644 index 000000000000..fc69fa0478d7 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/merge-20_b.C @@ -0,0 +1,5 @@ +// PR c++/122422 +// { dg-additional-options "-fmodules -fno-module-lazy" } + +#include "merge-20.h" +import "merge-20_a.H"; diff --git a/gcc/testsuite/g++.dg/tree-ssa/copy-prop-aggregate-sra-1.C b/gcc/testsuite/g++.dg/tree-ssa/copy-prop-aggregate-sra-1.C new file mode 100644 index 000000000000..52f1779bf519 --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/copy-prop-aggregate-sra-1.C @@ -0,0 +1,33 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-forwprop1-details -fdump-tree-esra-details -fexceptions" } */ + +/* PR tree-optimization/122247 */ + +struct s1 +{ + int t[1024]; +}; + +struct s1 f(void); + +void g(int a, int b, int ); +void p(struct s1); +void h(struct s1 outer) +{ + { + struct s1 inner = outer; + p(inner); + } + g(outer.t[0], outer.t[1], outer.t[2]); +} +/* Forwprop should be able to copy prop the copy of `inner = outer` to the call of p. + Also remove this copy. */ + +/* { dg-final { scan-tree-dump-times "after previous" 1 "forwprop1" } } */ +/* { dg-final { scan-tree-dump-times "Removing dead store stmt inner = outer" 1 "forwprop1" } } */ + +/* The extra copy that was done by inlining is removed so SRA should not decide to cause + inner nor outer to be scalarized even for the 3 elements accessed afterwards. */ +/* { dg-final { scan-tree-dump-times "Disqualifying inner" 1 "esra" } } */ +/* { dg-final { scan-tree-dump-times "Disqualifying outer" 1 "esra" } } */ + diff --git a/gcc/testsuite/g++.dg/tree-ssa/copy-prop-aggregate-sra-2.C b/gcc/testsuite/g++.dg/tree-ssa/copy-prop-aggregate-sra-2.C new file mode 100644 index 000000000000..0b05d5d03af4 --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/copy-prop-aggregate-sra-2.C @@ -0,0 +1,31 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-forwprop1-details -fdump-tree-esra-details -fexceptions" } */ + +/* PR tree-optimization/122247 */ + +struct s1 +{ + int t[1024]; +}; + +struct s1 f(void); + +void g(int a, int b, int ); +void p(struct s1); +void h(struct s1 outer) +{ + struct s1 inner = outer; + p(inner); + g(outer.t[0], outer.t[1], outer.t[2]); +} +/* Forwprop should be able to copy prop the copy of `inner = outer` to the call of p. + Also remove this copy. */ + +/* { dg-final { scan-tree-dump-times "after previous" 1 "forwprop1" } } */ +/* { dg-final { scan-tree-dump-times "Removing dead store stmt inner = outer" 1 "forwprop1" } } */ + +/* The extra copy that was done by inlining is removed so SRA should not decide to cause + inner nor outer to be scalarized even for the 3 elements accessed afterwards. */ +/* { dg-final { scan-tree-dump-times "Disqualifying inner" 1 "esra" } } */ +/* { dg-final { scan-tree-dump-times "Disqualifying outer" 1 "esra" } } */ + diff --git a/gcc/testsuite/g++.dg/warn/pr80635-3.C b/gcc/testsuite/g++.dg/warn/pr80635-3.C new file mode 100644 index 000000000000..09fd6ee33920 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/pr80635-3.C @@ -0,0 +1,46 @@ +// PR tree-optimization/80635 +// { dg-do compile { target c++11 } } +// { dg-options "-O1 -Wmaybe-uninitialized" } + +using size_t = decltype (sizeof (1)); +inline void *operator new (size_t, void *p) { return p; } +template +struct optional +{ + optional () : m_dummy (), live (false) {} + void emplace () { new (&m_item) T (); live = true; } + ~optional () { if (live) m_item.~T (); } + + union + { + struct {} m_dummy; + T m_item; + }; + bool live; +}; + +extern int get (); +extern void set (int); + +struct A +{ + A () : m (get ()) {} + ~A () { set (m); } // { dg-bogus "may be used uninitialized in this function" } + + int m; +}; + +struct B +{ + B (); + ~B (); +}; + +void func () +{ + optional maybe_a; + optional maybe_b; + + maybe_a.emplace (); + maybe_b.emplace (); +} diff --git a/gcc/testsuite/g++.dg/warn/pr80635-4.C b/gcc/testsuite/g++.dg/warn/pr80635-4.C new file mode 100644 index 000000000000..7b3bf8876e00 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/pr80635-4.C @@ -0,0 +1,31 @@ +// PR tree-optimization/80635 +// { dg-do compile { target c++17 } } +// { dg-options "-O1 -Wmaybe-uninitialized" } + +#include + +extern int get (); +extern void set (int); + +struct A +{ + A () : m (get ()) {} + ~A () { set (m); } // { dg-bogus "may be used uninitialized in this function" } + + int m; +}; + +struct B +{ + B (); + ~B (); +}; + +void func () +{ + std::optional maybe_a; + std::optional maybe_b; + + maybe_a.emplace (); + maybe_b.emplace (); +} diff --git a/gcc/testsuite/g++.target/i386/cf_check-1.C b/gcc/testsuite/g++.target/i386/cf_check-1.C new file mode 100644 index 000000000000..59fcca6e4977 --- /dev/null +++ b/gcc/testsuite/g++.target/i386/cf_check-1.C @@ -0,0 +1,18 @@ +/* { dg-do compile { target { "i?86-*-* x86_64-*-*" } } } */ +/* { dg-options "-O2 -fcf-protection" } */ + +extern void foo (void) __attribute__((nocf_check)); +extern void foo (void); + +void +foo (void) +{ +} + +extern void bar (void); +extern void bar (void) __attribute__((nocf_check)); /* { dg-error "ambiguating new declaration" } */ + +void +bar (void) +{ +} diff --git a/gcc/testsuite/g++.target/i386/cf_check-2.C b/gcc/testsuite/g++.target/i386/cf_check-2.C new file mode 100644 index 000000000000..5718ab2f4528 --- /dev/null +++ b/gcc/testsuite/g++.target/i386/cf_check-2.C @@ -0,0 +1,14 @@ +/* { dg-do compile { target { "i?86-*-* x86_64-*-*" } } } */ +/* { dg-options "-O2 -fcf-protection" } */ + +extern void bar (void); +extern void bar (void) __attribute__((nocf_check)); /* { dg-error "ambiguating new declaration" } */ +extern void foo (void) __attribute__((nocf_check)); +extern void foo (void); + +void +func (void) +{ + bar (); + foo (); +} diff --git a/gcc/testsuite/g++.target/i386/cf_check-3.C b/gcc/testsuite/g++.target/i386/cf_check-3.C new file mode 100644 index 000000000000..79d3a254fcc5 --- /dev/null +++ b/gcc/testsuite/g++.target/i386/cf_check-3.C @@ -0,0 +1,19 @@ +/* { dg-do compile { target { "i?86-*-* x86_64-*-*" } } } */ +/* { dg-options "-O2 -fcf-protection" } */ +/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ +/* { dg-final { check-function-bodies "**" "" "" { target "*-*-*" } {^\t?\.} } } */ + +/* +**_Z3foov: +**.LFB[0-9]+: +** .cfi_startproc +** ret +**... +*/ + +extern void foo (void) __attribute__((nocf_check)); + +void +foo (void) +{ +} diff --git a/gcc/testsuite/g++.target/i386/cf_check-4.C b/gcc/testsuite/g++.target/i386/cf_check-4.C new file mode 100644 index 000000000000..57c40a548606 --- /dev/null +++ b/gcc/testsuite/g++.target/i386/cf_check-4.C @@ -0,0 +1,23 @@ +/* { dg-do compile { target { "i?86-*-* x86_64-*-*" } } } */ +/* { dg-require-weak "" } */ +/* { dg-options "-O2 -fcf-protection" } */ +/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ +/* { dg-final { check-function-bodies "**" "" "" { target "*-*-*" } {^\t?\.} } } */ + +/* +**_Z3foov: +**.LFB[0-9]+: +** .cfi_startproc +** ret +**... +*/ + +extern void foo (void) __attribute__((nocf_check)); + +__attribute__((weak)) +void +foo (void) +{ +} + +/* { dg-final { scan-assembler ".weak\[ \t\]_?_Z3foov" } } */ diff --git a/gcc/testsuite/gcc.dg/builtin-assume-aligned-1.c b/gcc/testsuite/gcc.dg/builtin-assume-aligned-1.c index a74eccee4ab8..01aa884d0bc5 100644 --- a/gcc/testsuite/gcc.dg/builtin-assume-aligned-1.c +++ b/gcc/testsuite/gcc.dg/builtin-assume-aligned-1.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O3 -fdump-tree-optimized" } */ +/* { dg-options "-O3 -fno-tree-vectorize -fdump-tree-optimized-alias" } */ void test1 (double *out1, double *out2, double *out3, double *in1, @@ -19,6 +19,8 @@ test1 (double *out1, double *out2, double *out3, double *in1, } } +/* { dg-final { scan-tree-dump-times " ALIGN = 16, MISALIGN = 0" 5 "optimized" } } */ + void test2 (double *out1, double *out2, double *out3, double *in1, double *in2, int len) @@ -37,4 +39,8 @@ test2 (double *out1, double *out2, double *out3, double *in1, } } -/* { dg-final { scan-tree-dump-not "__builtin_assume_aligned" "optimized" } } */ + +/* { dg-final { scan-tree-dump-times " ALIGN = 32" 5 "optimized" } } */ +/* { dg-final { scan-tree-dump-times " ALIGN = 32, MISALIGN = 16" 4 "optimized" } } */ +/* { dg-final { scan-tree-dump-times " ALIGN = 32, MISALIGN = 0" 1 "optimized" } } */ + diff --git a/gcc/testsuite/gcc.dg/cpp/escape-3.i b/gcc/testsuite/gcc.dg/cpp/escape-3.i index 6eb7dc4b2708..cb4758190f7e 100644 --- a/gcc/testsuite/gcc.dg/cpp/escape-3.i +++ b/gcc/testsuite/gcc.dg/cpp/escape-3.i @@ -13,4 +13,4 @@ int foo (int a, int b) } /* Test for "/some\\directory" instead of "/some\\\\directory" */ -/* { dg-final { scan-assembler { "/some\\\\directory" } } } */ +/* { dg-final { scan-assembler "/some\\\\\\\\directory" } } */ diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-prune-4.c b/gcc/testsuite/gcc.dg/debug/btf/btf-prune-4.c new file mode 100644 index 000000000000..3f1955938128 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-prune-4.c @@ -0,0 +1,61 @@ +/* Test that -gprune-btf does not prune at typedefs. */ + +/* { dg-do compile } */ +/* { dg-options "-gbtf -gprune-btf -dA" } */ + +/* We must have the full definitions of td1 and td3. Neither are pruned. + td2 will be skipped entirely, only because the only reference to + it is through struct inner, which is pruned because inner itself + is only used as a pointer member. + + In general, we must never get an anonymous FWD; the only FWD in this + case will be for 'inner' */ + +/* Exactly 1 FWD for inner and no anonymous FWD. */ +/* { dg-final { scan-assembler-times "TYPE \[0-9\]+ BTF_KIND_FWD" 1 } } */ +/* { dg-final { scan-assembler-not "TYPE \[0-9\]+ BTF_KIND_FWD ''" } } */ +/* { dg-final { scan-assembler " BTF_KIND_FWD 'inner'" } } */ + +/* One anonymous struct for td1 and one anonymous union for td3. */ +/* { dg-final { scan-assembler-times "TYPE \[0-9\]+ BTF_KIND_STRUCT ''" 1 } } */ +/* { dg-final { scan-assembler-times "TYPE \[0-9\]+ BTF_KIND_UNION ''" 1 } } */ + +/* The two remaining typedefs. */ +/* { dg-final { scan-assembler " BTF_KIND_TYPEDEF 'td1'" } } */ +/* { dg-final { scan-assembler " BTF_KIND_TYPEDEF 'td3'" } } */ + +typedef struct { + int x; + char c; +} td1; + +typedef struct { + long l; + char b[4]; +} td2; + +typedef union { + long l; + unsigned short s[2]; +} td3; + +struct inner { + char a; + td2 *ptd; + long z; +}; + +struct A { + td1 *pt; + struct inner *in; + unsigned long l[4]; +}; + +struct A foo; + +struct B { + int x; + td3 **ppptd3; +}; + +struct B bar; diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-4.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-4.c new file mode 100644 index 000000000000..6fdcdc6e864c --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-4.c @@ -0,0 +1,28 @@ +/* Test DWARF generation for decl_tags on global decls appearing multiple + times with different decl_tags. PR122248. */ +/* { dg-do compile } */ +/* { dg-options "-gdwarf -dA" } */ + +#define __tag1 __attribute__((btf_decl_tag ("tag1"))) +#define __tag2 __attribute__((btf_decl_tag ("tag2"))) +#define __tag3 __attribute__((btf_decl_tag ("tag3"))) +#define __tag4 __attribute__((btf_decl_tag ("tag4"))) + +int foo __tag1; +int foo __tag2; + +/* Result: foo has __tag1 and __tag2. */ + +int bar __tag3; +int bar; + +/* Result: bar has __tag3. */ + +int baz; +int baz __tag4; + +/* Result: baz has __tag4. */ + +/* { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_GNU_annotation" 4 } } */ +/* { dg-final { scan-assembler-times " DW_AT_GNU_annotation" 4 } } */ + diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-5.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-5.c new file mode 100644 index 000000000000..c7cb60ca986c --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-5.c @@ -0,0 +1,35 @@ +/* Test DWARF generation for decl_tags on global decls appearing multiple + times with different decl_tags. PR122248. */ +/* { dg-do compile } */ +/* { dg-options "-gdwarf -dA" } */ + +#define __tag1 __attribute__((btf_decl_tag ("tag1"))) +#define __tag2 __attribute__((btf_decl_tag ("tag2"))) +#define __tag3 __attribute__((btf_decl_tag ("tag3"))) + +struct S +{ + int x; + char c; +}; + +extern struct S foo __tag1; +struct S foo __tag2; + +/* Result: non-completing variable DIE for 'foo' has tag1, and the + completing DIE (with AT_specification) for 'foo' has tag2 -> tag1. */ + +extern int a __tag3; +int a; + +/* Result: non-completing variable DIE for a has tag3, and the + completing DIE (with AT_specification) for 'a' also refers to tag3. */ + +/* { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_GNU_annotation" 3 } } */ + +/* 5 AT_GNU annotations: + - foo -> tag1 + - foo -> tag2 -> tag1 + - a -> tag3 + - a -> tag3 */ +/* { dg-final { scan-assembler-times " DW_AT_GNU_annotation" 5 } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-6.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-6.c new file mode 100644 index 000000000000..dd89d1142b9a --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-6.c @@ -0,0 +1,24 @@ +/* Test DWARF generation for decl_tags on global decls appearing multiple + times with different decl_tags. PR122248. */ +/* { dg-do compile } */ +/* { dg-options "-gdwarf -dA" } */ + +#define __tag1 __attribute__((btf_decl_tag ("tag1"))) +#define __tag2 __attribute__((btf_decl_tag ("tag2"))) +#define __tag3 __attribute__((btf_decl_tag ("tag3"))) + +__tag1 +extern int +do_thing (int); + +__tag2 +__tag3 +int +do_thing (int x) +{ + return x * x; +} + +/* Result: do_thing has all 3 tags. */ +/* { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_GNU_annotation" 3 } } */ +/* { dg-final { scan-assembler-times " DW_AT_GNU_annotation" 3 } } */ diff --git a/gcc/testsuite/gcc.dg/pointer-counted-by-10.c b/gcc/testsuite/gcc.dg/pointer-counted-by-10.c new file mode 100644 index 000000000000..e2bd018a90b7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pointer-counted-by-10.c @@ -0,0 +1,8 @@ +/* Testing the correct usage of attribute counted_by for pointer to void. */ +/* { dg-do compile } */ +/* { dg-options "-O0 -Wpointer-arith" } */ + +struct pointer_array { + int count; + void *array __attribute__ ((counted_by (count))); /* { dg-warning "attribute is used for a pointer to void" } */ +}; diff --git a/gcc/testsuite/gcc.dg/pointer-counted-by-4-void.c b/gcc/testsuite/gcc.dg/pointer-counted-by-4-void.c new file mode 100644 index 000000000000..71bac95dfb24 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pointer-counted-by-4-void.c @@ -0,0 +1,6 @@ +/* Test the attribute counted_by for pointer field and its usage in + * __builtin_dynamic_object_size. */ +/* { dg-do run } */ +/* { dg-options "-O2" } */ +#define PTR_TYPE void +#include "pointer-counted-by-4.c" diff --git a/gcc/testsuite/gcc.dg/pointer-counted-by.c b/gcc/testsuite/gcc.dg/pointer-counted-by.c index 0f18828ac113..5e9ebef4ce5b 100644 --- a/gcc/testsuite/gcc.dg/pointer-counted-by.c +++ b/gcc/testsuite/gcc.dg/pointer-counted-by.c @@ -49,9 +49,10 @@ struct pointer_array_6 { int *array_6 __attribute__ ((counted_by (days))); }; +/* counted_by is allowed for pointer to void when GNU extension is enabled. */ struct pointer_array_7 { int count; - void *array_7 __attribute__ ((counted_by (count))); /* { dg-error "attribute is not allowed for a pointer to void" } */ + void *array_7 __attribute__ ((counted_by (count))); }; struct pointer_array_8 { diff --git a/gcc/testsuite/gcc.dg/pr116815.c b/gcc/testsuite/gcc.dg/pr116815.c new file mode 100644 index 000000000000..b5f1330b3352 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr116815.c @@ -0,0 +1,57 @@ +/* PR target/116815 */ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +[[gnu::always_inline]] +inline unsigned min (unsigned a, unsigned b) +{ + return (a < b) ? a : b; +} + +[[gnu::always_inline]] +inline unsigned max (unsigned a, unsigned b) +{ + return (a > b) ? a : b; +} + +[[gnu::noipa]] unsigned +umaxadd (unsigned a, unsigned b) +{ + return max (a + b, a); +} + +[[gnu::noipa]] unsigned +umaxsub (unsigned a, unsigned b) +{ + return max (a - b, a); +} + +[[gnu::noipa]] unsigned +uminadd (unsigned a, unsigned b) +{ + return min (a + b, a); +} + +[[gnu::noipa]] unsigned +uminsub (unsigned a, unsigned b) +{ + return min (a - b, a); +} + +int +main () +{ + /* Overflows to 0x30000000. */ + if (umaxadd (0x90000000, 0xa0000000) != 0x90000000) + __builtin_abort (); + + if (uminadd (0x90000000, 0xa0000000) != 0x30000000) + __builtin_abort (); + + /* Underflows to 0x60000000. */ + if (umaxsub (0x00000000, 0xa0000000) != 0x60000000) + __builtin_abort (); + + if (uminsub (0x00000000, 0xa0000000) != 0x00000000) + __builtin_abort (); +} diff --git a/gcc/testsuite/gcc.dg/pr41488.c b/gcc/testsuite/gcc.dg/pr41488.c index 1e4bf19c7da9..a7ba3672efef 100644 --- a/gcc/testsuite/gcc.dg/pr41488.c +++ b/gcc/testsuite/gcc.dg/pr41488.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-ivcanon-scev" } */ +/* { dg-options "-O2 -fno-tree-scev-cprop -fdump-tree-ivcanon-scev" } */ struct struct_t { diff --git a/gcc/testsuite/gcc.dg/pr91191.c b/gcc/testsuite/gcc.dg/pr91191.c new file mode 100644 index 000000000000..7bf727e5b4f6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr91191.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-evrp" } */ + +unsigned char reg(_Bool b) { + union U { + unsigned char f0; + _Bool f1; + }; + union U u; + u.f1 = b; + if (u.f0 > 1) { + // This cannot happen + // if b is only allowed + // to be 0 or 1: + return 42; + } + return 13; +} + +/* { dg-final { scan-tree-dump "return 13" "evrp" } } */ diff --git a/gcc/testsuite/gcc.dg/torture/pr122497-1.c b/gcc/testsuite/gcc.dg/torture/pr122497-1.c new file mode 100644 index 000000000000..8b027ca3aaad --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr122497-1.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* PR tree-optimization/122497 */ + +/* This was ICEing during SCCP + trying to simplify a reference back to the phi + which was removed. */ + +char g_2[1][2]; +int g_4, g_5; +void main() { + for (; g_4; g_4 -= 1) + g_5 = g_2[g_4 + 2][g_4]; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr122502.c b/gcc/testsuite/gcc.dg/torture/pr122502.c new file mode 100644 index 000000000000..5e2cb2e8163f --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr122502.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ + +short int *ts; + +void +c2 (unsigned long long int s4, int ns) +{ + short int *b2 = (short int *)&ns; + + while (ns != 0) + { + int xn; + + for (xn = 0; xn < 3; ++xn) + for (*b2 = 0; *b2 < 2; ++*b2) + s4 += xn; + if (s4 != 0) + b2 = ts; + ++ns; + } +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ctz-ch.c b/gcc/testsuite/gcc.dg/tree-ssa/ctz-ch.c new file mode 100644 index 000000000000..5d725979971b --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ctz-ch.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +typedef unsigned long BITMAP_WORD; + +bool +bmp_iter_set (BITMAP_WORD bits, unsigned *bit_no) +{ + /* If our current word is nonzero, it contains the bit we want. */ + if (bits) + { + while (!(bits & 1)) + { + bits >>= 1; + *bit_no += 1; + } + return true; + } + + return false; +} + +/* { dg-final { scan-tree-dump-times "__builtin_ctz|\\.CTZ" 1 "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ctz-char.c b/gcc/testsuite/gcc.dg/tree-ssa/ctz-char.c index 3cd166acbd46..fa8b7f39de4b 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ctz-char.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ctz-char.c @@ -1,6 +1,6 @@ /* { dg-do run } */ /* { dg-require-effective-target ctz } */ -/* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ #define PREC (__CHAR_BIT__) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-char.c b/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-char.c index b9afe8852d8f..5ebc32131692 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-char.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-char.c @@ -1,6 +1,6 @@ /* { dg-do run } */ /* { dg-require-effective-target ctz } */ -/* { dg-options "-O2 -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */ #define PREC (__CHAR_BIT__) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-int.c b/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-int.c index d2702a65daf3..0ce4b6beaa7d 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-int.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-int.c @@ -1,6 +1,6 @@ /* { dg-do run } */ /* { dg-require-effective-target ctz } */ -/* { dg-options "-O2 -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */ #define PREC (__CHAR_BIT__ * __SIZEOF_INT__) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-long-long.c b/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-long-long.c index 1ea0d5d7d9f8..f98bec039b35 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-long-long.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-long-long.c @@ -1,6 +1,6 @@ /* { dg-do run } */ /* { dg-require-effective-target ctzll } */ -/* { dg-options "-O2 -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */ #define PREC (__CHAR_BIT__ * __SIZEOF_LONG_LONG__) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-long.c b/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-long.c index 80fb02dcfa68..8edb3728131c 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-long.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-long.c @@ -1,6 +1,6 @@ /* { dg-do run } */ /* { dg-require-effective-target ctzl } */ -/* { dg-options "-O2 -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */ #define PREC (__CHAR_BIT__ * __SIZEOF_LONG__) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ctz-int.c b/gcc/testsuite/gcc.dg/tree-ssa/ctz-int.c index 7f63493eb738..2bf3ae69b938 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ctz-int.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ctz-int.c @@ -1,6 +1,6 @@ /* { dg-do run } */ /* { dg-require-effective-target ctz } */ -/* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ #define PREC (__CHAR_BIT__ * __SIZEOF_INT__) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ctz-long-long.c b/gcc/testsuite/gcc.dg/tree-ssa/ctz-long-long.c index 924f61b76f01..2e159485cb98 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ctz-long-long.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ctz-long-long.c @@ -1,6 +1,6 @@ /* { dg-do run } */ /* { dg-require-effective-target ctzll } */ -/* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ #define PREC (__CHAR_BIT__ * __SIZEOF_LONG_LONG__) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ctz-long.c b/gcc/testsuite/gcc.dg/tree-ssa/ctz-long.c index 178945daa8a2..2e3be652a0bc 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ctz-long.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ctz-long.c @@ -1,6 +1,6 @@ /* { dg-do run } */ /* { dg-require-effective-target ctzl } */ -/* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ #define PREC (__CHAR_BIT__ * __SIZEOF_LONG__) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-42.c b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-42.c new file mode 100644 index 000000000000..5785e51c0895 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-42.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-forwprop1" } */ + +typedef unsigned int vec2 __attribute__ ((vector_size (2 * sizeof (unsigned int)))); +typedef unsigned int vec1 __attribute__ ((vector_size (sizeof (unsigned int)))); + +vec1 foo (vec2 x) +{ + return (vec1) x[1]; +} + +/* { dg-final { scan-tree-dump-not "VIEW_CONVERT_EXPR" "forwprop1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr122478.c b/gcc/testsuite/gcc.dg/tree-ssa/pr122478.c new file mode 100644 index 000000000000..a39c91bc2a9d --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr122478.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ +/* { dg-additional-options "-fgimple" } */ + +unsigned char __GIMPLE (ssa) +foo (unsigned short mask__701) +{ + _Bool _19; + unsigned char _180; + +__BB(2): + _19 = __BIT_FIELD_REF <_Bool> (mask__701, 1, 12); + _180 = __VIEW_CONVERT(_19); + return _180; +} + +/* { dg-final { scan-tree-dump-times "VIEW_CONVERT_EXPR" 1 "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr92834.c b/gcc/testsuite/gcc.dg/tree-ssa/pr92834.c index 889048d3840d..70acf74b3a00 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr92834.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr92834.c @@ -1,8 +1,8 @@ /* PR tree-optimization/92834 */ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-optimized" } */ -/* { dg-final { scan-tree-dump-times "MIN_EXPR <" 8 "optimized" } } */ -/* { dg-final { scan-tree-dump-times "MAX_EXPR <" 8 "optimized" } } */ +/* { dg-options "-O2 -fdump-tree-phiopt1" } */ +/* { dg-final { scan-tree-dump-times "MIN_EXPR <" 16 "phiopt1" } } */ +/* { dg-final { scan-tree-dump-times "MAX_EXPR <" 16 "phiopt1" } } */ static inline unsigned umax1 (unsigned a, unsigned b) diff --git a/gcc/testsuite/gcc.dg/vect/slp-reduc-13.c b/gcc/testsuite/gcc.dg/vect/slp-reduc-13.c new file mode 100644 index 000000000000..00e91fc6251b --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/slp-reduc-13.c @@ -0,0 +1,66 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target vect_int } */ +/* { dg-additional-options "-fgimple" } */ + +int q[2]; + +void __GIMPLE (ssa,guessed_local(16535624),startwith("loop")) +foo (int * r) +{ + int i; + int sum2; + int sum1; + int _1; + long unsigned int _2; + long unsigned int _3; + int * _4; + int _24; + __SIZETYPE__ _6; + __SIZETYPE__ _7; + int * _8; + int _9; + int _13; + unsigned int _30; + unsigned int _31; + + __BB(2,guessed_local(16535624)): + goto __BB3(precise(134217728)); + + __BB(3,loop_header(1),guessed_local(1057206200)): + sum1_5 = __PHI (__BB5: sum1_18, __BB2: 0); + sum2_26 = __PHI (__BB5: sum2_19, __BB2: 0); + i_28 = __PHI (__BB5: i_20, __BB2: 0); + _31 = __PHI (__BB5: _30, __BB2: 64u); + _1 = i_28 * 2; + _2 = (long unsigned int) _1; + _3 = _2 * 4ul; + _4 = r_17(D) + _3; + _24 = __MEM (_4); + /* Deliberately have swapped operands here */ + sum1_18 = sum1_5 + _24; + _13 = _1 + 1; + _6 = (__SIZETYPE__) _13; + _7 = _6 * 4ul; + _8 = r_17(D) + _7; + _9 = __MEM (_8); + /* versus here. */ + sum2_19 = _9 + sum2_26; + i_20 = i_28 + 1; + _30 = _31 - 1u; + if (_30 != 0u) + goto __BB5(guessed(132118446)); + else + goto __BB4(guessed(2099282)); + + __BB(5,guessed_local(1040670576)): + goto __BB3(precise(134217728)); + + __BB(4,guessed_local(16535624)): + sum1_33 = __PHI (__BB3: sum1_18); + sum2_32 = __PHI (__BB3: sum2_19); + q[0] = sum1_33; + q[1] = sum2_32; + return; +} + +/* { dg-final { scan-tree-dump "SLP discovery of size 2 reduction group succeeded" "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/slp-widen-mult-half.c b/gcc/testsuite/gcc.dg/vect/slp-widen-mult-half.c index b69ade338862..72811eb852e5 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-widen-mult-half.c +++ b/gcc/testsuite/gcc.dg/vect/slp-widen-mult-half.c @@ -1,7 +1,6 @@ /* Disabling epilogues until we find a better way to deal with scans. */ /* { dg-additional-options "--param vect-epilogues-nomask=0" } */ /* { dg-require-effective-target vect_int } */ -/* { dg-additional-options "-mlasx" { target loongarch*-*-* } } */ #include "tree-vect.h" diff --git a/gcc/testsuite/gcc.dg/vect/tree-vect.h b/gcc/testsuite/gcc.dg/vect/tree-vect.h index 1e4b56ee0e15..37908c911abb 100644 --- a/gcc/testsuite/gcc.dg/vect/tree-vect.h +++ b/gcc/testsuite/gcc.dg/vect/tree-vect.h @@ -76,6 +76,8 @@ check_vect (void) } #elif defined(__mips_msa) asm volatile ("or.v $w0,$w0,$w0"); +#elif defined(__loongarch__) + asm volatile ("vor.v\t$vr0,$vr0,$vr0"); #endif signal (SIGILL, SIG_DFL); } diff --git a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-const-s16.c b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-const-s16.c index 53c9b84ca016..dfbb2171c004 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-const-s16.c +++ b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-const-s16.c @@ -2,7 +2,6 @@ /* { dg-additional-options "--param vect-epilogues-nomask=0" } */ /* { dg-require-effective-target vect_int } */ /* { dg-additional-options "-fno-ipa-icf" } */ -/* { dg-additional-options "-mlasx" { target loongarch*-*-*} } */ #include "tree-vect.h" diff --git a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-const-u16.c b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-const-u16.c index e9db8285b664..c2ad58f69e7f 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-const-u16.c +++ b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-const-u16.c @@ -2,7 +2,6 @@ /* { dg-additional-options "--param vect-epilogues-nomask=0" } */ /* { dg-require-effective-target vect_int } */ /* { dg-additional-options "-fno-ipa-icf" } */ -/* { dg-additional-options "-mlasx" { target loongarch*-*-*} } */ #include "tree-vect.h" diff --git a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-half-u8.c b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-half-u8.c index 607f3178f903..bfdcbaa09fbd 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-half-u8.c +++ b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-half-u8.c @@ -2,7 +2,6 @@ /* { dg-additional-options "--param vect-epilogues-nomask=0" } */ /* { dg-require-effective-target vect_int } */ /* { dg-additional-options "-fno-ipa-icf" } */ -/* { dg-additional-options "-mlasx" { target loongarch*-*-*} } */ #include "tree-vect.h" diff --git a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-half.c b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-half.c index cd13d8269374..e46b0cc3135f 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-half.c +++ b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-half.c @@ -1,7 +1,6 @@ /* Disabling epilogues until we find a better way to deal with scans. */ /* { dg-additional-options "--param vect-epilogues-nomask=0" } */ /* { dg-require-effective-target vect_int } */ -/* { dg-additional-options "-mlasx" { target loongarch*-*-*} } */ #include "tree-vect.h" diff --git a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u16.c b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u16.c index 258d253f4014..14411ef43eda 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u16.c +++ b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u16.c @@ -1,7 +1,6 @@ /* Disabling epilogues until we find a better way to deal with scans. */ /* { dg-additional-options "--param vect-epilogues-nomask=0" } */ /* { dg-require-effective-target vect_int } */ -/* { dg-additional-options "-mlasx" { target loongarch*-*-*} } */ #include #include "tree-vect.h" diff --git a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8-s16-s32.c b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8-s16-s32.c index 3baafca7b548..f40def5dddf5 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8-s16-s32.c +++ b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8-s16-s32.c @@ -1,7 +1,6 @@ /* Disabling epilogues until we find a better way to deal with scans. */ /* { dg-additional-options "--param vect-epilogues-nomask=0" } */ /* { dg-require-effective-target vect_int } */ -/* { dg-additional-options "-mlasx" { target loongarch*-*-*} } */ #include #include "tree-vect.h" diff --git a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8-u32.c b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8-u32.c index bcfbe198a3ff..63866390835c 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8-u32.c +++ b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8-u32.c @@ -1,6 +1,5 @@ /* { dg-additional-options "--param vect-epilogues-nomask=0" } */ /* { dg-require-effective-target vect_int } */ -/* { dg-additional-options "-mlasx" { target loongarch*-*-* } } */ #include #include "tree-vect.h" diff --git a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8.c b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8.c index e3bf13b14fa5..78ad74b5d499 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8.c +++ b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8.c @@ -1,6 +1,5 @@ /* { dg-additional-options "--param vect-epilogues-nomask=0" } */ /* { dg-require-effective-target vect_int } */ -/* { dg-additional-options "-mlasx" { target loongarch*-*-*} } */ #include #include "tree-vect.h" diff --git a/gcc/testsuite/gcc.target/aarch64/pr121853_1.c b/gcc/testsuite/gcc.target/aarch64/pr121853_1.c new file mode 100644 index 000000000000..24b2fdc8cea1 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr121853_1.c @@ -0,0 +1,64 @@ +/* { dg-do run } */ +/* { dg-additional-options "-O2 -std=c99" } */ + +#include +#include +#include + +__attribute__ ((noipa)) +float convert(__bf16 value) { + return (float)value; +} + +static inline uint32_t f32_bits(float f) { + uint32_t u; memcpy(&u, &f, sizeof u); return u; +} +static inline __bf16 bf16_from_bits(uint16_t u) { + __bf16 b; memcpy(&b, &u, sizeof b); return b; +} + +/* Fixed bf16 inputs (as raw 16-bit payloads) covering edge cases. */ +static const uint16_t inputs[] = { + 0x0000, // +0 + 0x8000, // -0 + 0x7F80, // +inf + 0xFF80, // -inf + 0x7FC0, // qNaN (+) (quiet bit set in bf16) + 0xFFC0, // qNaN (-) + 0x7F01, // sNaN (+) (will be quieted by conversion) + 0xFF01, // sNaN (-) + 0x0001, // smallest +subnormal + 0x007F, // largest +subnormal + 0x8001, // smallest -subnormal + 0x807F, // largest -subnormal + 0x0080, // smallest +normal + 0x3F80, // +1.0 + 0xBF80, // -1.0 + 0x3F00, // +0.5 + 0xBF00, // -0.5 + 0x3FC0, // +1.5 + 0x7F7F, // max finite + + 0xFF7F, // max finite - +}; + +int main(void) { + const size_t N = sizeof(inputs)/sizeof(inputs[0]); + size_t fails = 0; + + for (size_t i = 0; i < N; ++i) { + __bf16 in = bf16_from_bits(inputs[i]); + float out = convert(in); + uint32_t got = f32_bits(out); + uint32_t exp = inputs[i] << 16; + + if (got != exp) { + printf("FAIL[%zu]: in_bf16=0x%04X exp_f32=0x%08X got_f32=0x%08X\n", + i, inputs[i], exp, got); + ++fails; + } + } + + if (fails != 0) + __builtin_abort (); +} + diff --git a/gcc/testsuite/gcc.target/aarch64/pr121853_2.c b/gcc/testsuite/gcc.target/aarch64/pr121853_2.c new file mode 100644 index 000000000000..e9fb4016bcb7 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr121853_2.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-O1" } */ +/* { dg-final { check-function-bodies "**" "" } } */ + +float convert(__bf16 value) { + return (float)value; +} + +/* +** convert: +** movi v[0-9]+.4s, 0 +** ext v[0-9]+.16b, v[0-9]+.16b, v[0-9]+.16b, #14 +** ret +*/ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/dup-insr-1.c b/gcc/testsuite/gcc.target/aarch64/sve/dup-insr-1.c new file mode 100644 index 000000000000..41dcbba45cf2 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/dup-insr-1.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-optimized" } */ +/* PR target/116075 */ + +#include + +svint8_t f(void) +{ + svint8_t tt; + tt = svdup_s8 (0); + tt = svinsr (tt, 0); + return tt; +} + +svint8_t f1(int8_t t) +{ + svint8_t tt; + tt = svdup_s8 (t); + tt = svinsr (tt, t); + return tt; +} + +/* The above 2 functions should have removed the VEC_SHL_INSERT. */ + +/* { dg-final { scan-tree-dump-not ".VEC_SHL_INSERT " "optimized" } } */ + diff --git a/gcc/testsuite/gcc.target/aarch64/sve/dup-insr-2.c b/gcc/testsuite/gcc.target/aarch64/sve/dup-insr-2.c new file mode 100644 index 000000000000..8eafe9746241 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/dup-insr-2.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-optimized" } */ +/* PR target/116075 */ + +#include + +svint8_t f(int8_t t) +{ + svint8_t tt; + tt = svdup_s8 (0); + tt = svinsr (tt, t); + return tt; +} + +svint8_t f1(int8_t t) +{ + svint8_t tt; + tt = svdup_s8 (t); + tt = svinsr (tt, 0); + return tt; +} + +/* The above 2 functions should not have removed the VEC_SHL_INSERT. */ + +/* { dg-final { scan-tree-dump-times ".VEC_SHL_INSERT " 2 "optimized" } } */ + diff --git a/gcc/testsuite/gcc.target/avr/pr121198.c b/gcc/testsuite/gcc.target/avr/pr121198.c new file mode 100644 index 000000000000..551247e1d34b --- /dev/null +++ b/gcc/testsuite/gcc.target/avr/pr121198.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-Os -mmcu=atmega8" } */ + +long +test (void) +{ + long x; + __asm__ ("" : "={r22}" (x)); + return x; +} diff --git a/gcc/testsuite/gcc.target/i386/cf_check-10.c b/gcc/testsuite/gcc.target/i386/cf_check-10.c new file mode 100644 index 000000000000..a131672f401f --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/cf_check-10.c @@ -0,0 +1,19 @@ +/* PR c/122427 */ +/* { dg-do compile { target { "i?86-*-* x86_64-*-*" } } } */ +/* { dg-options "-O2 -fcf-protection" } */ + +extern void foo (void) __attribute__((nocf_check)); +extern void foo (void); + +void +foo (void) +{ +} + +extern void bar (void); +extern void bar (void) __attribute__((nocf_check)); /* { dg-error "conflicting types" } */ + +void +bar (void) +{ +} diff --git a/gcc/testsuite/gcc.target/i386/cf_check-11.c b/gcc/testsuite/gcc.target/i386/cf_check-11.c new file mode 100644 index 000000000000..9ed65ab0ad5d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/cf_check-11.c @@ -0,0 +1,24 @@ +/* PR c/122427 */ +/* { dg-do compile { target { "i?86-*-* x86_64-*-*" } } } */ +/* { dg-require-weak "" } */ +/* { dg-options "-O2 -fcf-protection" } */ +/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ +/* { dg-final { check-function-bodies "**" "" "" { target "*-*-*" } {^\t?\.} } } */ + +/* +**foo: +**.LFB[0-9]+: +** .cfi_startproc +** ret +**... +*/ + +extern void foo (void) __attribute__((nocf_check)); + +__attribute__((weak)) +void +foo (void) +{ +} + +/* { dg-final { scan-assembler ".weak\[ \t\]_?foo" } } */ diff --git a/gcc/testsuite/gcc.target/i386/cf_check-7.c b/gcc/testsuite/gcc.target/i386/cf_check-7.c new file mode 100644 index 000000000000..b9a3b3950562 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/cf_check-7.c @@ -0,0 +1,20 @@ +/* PR c/122427 */ +/* { dg-do compile { target { "i?86-*-* x86_64-*-*" } } } */ +/* { dg-options "-O2 -fcf-protection" } */ +/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ +/* { dg-final { check-function-bodies "**" "" "" { target "*-*-*" } {^\t?\.} } } */ + +/* +**foo: +**.LFB[0-9]+: +** .cfi_startproc +** ret +**... +*/ + +extern void foo (void) __attribute__((nocf_check)); + +void +foo (void) +{ +} diff --git a/gcc/testsuite/gcc.target/i386/cf_check-8.c b/gcc/testsuite/gcc.target/i386/cf_check-8.c new file mode 100644 index 000000000000..48e8cf198cbd --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/cf_check-8.c @@ -0,0 +1,11 @@ +/* PR c/122427 */ +/* { dg-do compile { target { "i?86-*-* x86_64-*-*" } } } */ +/* { dg-options "-O2 -fcf-protection" } */ + +extern void foo (void); + +__attribute__((nocf_check)) +void +foo (void) /* { dg-error "conflicting types" } */ +{ +} diff --git a/gcc/testsuite/gcc.target/i386/cf_check-9.c b/gcc/testsuite/gcc.target/i386/cf_check-9.c new file mode 100644 index 000000000000..057c60f68149 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/cf_check-9.c @@ -0,0 +1,15 @@ +/* PR c/122427 */ +/* { dg-do compile { target { "i?86-*-* x86_64-*-*" } } } */ +/* { dg-options "-O2 -fcf-protection" } */ + +extern void bar (void); +extern void bar (void) __attribute__((nocf_check)); /* { dg-error "conflicting types" } */ +extern void foo (void) __attribute__((nocf_check)); +extern void foo (void); + +void +func (void) +{ + bar (); + foo (); +} diff --git a/gcc/testsuite/gcc.target/i386/no-callee-saved-12.c b/gcc/testsuite/gcc.target/i386/no-callee-saved-12.c index 5524a4af29ce..8f9b725e9113 100644 --- a/gcc/testsuite/gcc.target/i386/no-callee-saved-12.c +++ b/gcc/testsuite/gcc.target/i386/no-callee-saved-12.c @@ -1,10 +1,9 @@ /* { dg-do compile } */ /* { dg-options "-O2" } */ -extern void foo (void) __attribute__ ((no_callee_saved_registers)); /* { dg-note "previous declaration" } */ +extern void foo (void) __attribute__ ((no_callee_saved_registers)); void -foo (void) /* { dg-error "conflicting types" } */ +foo (void) { } - diff --git a/gcc/testsuite/gcc.target/i386/pr116815.c b/gcc/testsuite/gcc.target/i386/pr116815.c new file mode 100644 index 000000000000..1cd2f72c3b45 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr116815.c @@ -0,0 +1,31 @@ +/* PR target/116815 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-additional-options "-march=pentiumpro" { target ia32 } } */ + +static inline __attribute__ ((always_inline)) +unsigned max (unsigned a, unsigned b) { return a > b ? a : b; } + +static inline __attribute__ ((always_inline)) +unsigned min (unsigned a, unsigned b) { return a < b ? a : b; } + +#define OPERATION(op, type, N, exp1, exp2) \ + unsigned u##op##type##N (unsigned a, unsigned b) { return op (exp1, exp2); } + +OPERATION (max, add, 1, a, a + b) +OPERATION (max, add, 2, a, b + a) +OPERATION (max, add, 3, a + b, a) +OPERATION (max, add, 4, b + a, a) + +OPERATION (min, add, 1, a, a + b) +OPERATION (min, add, 2, a, b + a) +OPERATION (min, add, 3, a + b, a) +OPERATION (min, add, 4, b + a, a) + +OPERATION (max, sub, 1, a, a - b) +OPERATION (max, sub, 2, a - b, a) + +OPERATION (min, sub, 1, a, a - b) +OPERATION (min, sub, 2, a - b, a) + +/* { dg-final { scan-assembler-not "cmp" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr122457.c b/gcc/testsuite/gcc.target/i386/pr122457.c new file mode 100644 index 000000000000..dc57fb207a12 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr122457.c @@ -0,0 +1,4 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=x86-64-v4 -mavxvnniint16" } */ + +#include "vnniint16-auto-vectorize-2.c" diff --git a/gcc/testsuite/gcc.target/i386/preserve-none-17.c b/gcc/testsuite/gcc.target/i386/preserve-none-17.c index e105da1b7095..0c62edd0fd02 100644 --- a/gcc/testsuite/gcc.target/i386/preserve-none-17.c +++ b/gcc/testsuite/gcc.target/i386/preserve-none-17.c @@ -1,10 +1,9 @@ /* { dg-do compile } */ /* { dg-options "-O2" } */ -extern void foo (void) __attribute__ ((preserve_none)); /* { dg-note "previous declaration" } */ +extern void foo (void) __attribute__ ((preserve_none)); void -foo (void) /* { dg-error "conflicting types" } */ +foo (void) { } - diff --git a/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-1.c b/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-1.c index ed13471aa90a..47802aa9688d 100644 --- a/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-1.c +++ b/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-1.c @@ -27,7 +27,7 @@ void test_lt () { if (lm < ln) - lr *= (1 << 16); + lr += (1 << 16); lr += lm; } @@ -35,7 +35,7 @@ void test_le () { if (lm <= ln) - lr = lm * ((long)1 << 32); + lr = lm + ((long)1 << 32); else lr = lm; lr += lm; diff --git a/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-2.c b/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-2.c index ac72d4d933ad..743fd5e670e2 100644 --- a/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-2.c +++ b/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-2.c @@ -29,7 +29,7 @@ void test_lez () { if (lm <= 0) - lr &= (1 << 16); + lr |= (1 << 16); lr += lm; } diff --git a/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-3.c b/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-3.c new file mode 100644 index 000000000000..95887980cc5f --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-3.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-final { scan-assembler "maskeqz" } } */ +/* { dg-final { scan-assembler "masknez" } } */ + +extern long lm, ln, lr; + +void +test_and () +{ + if (lm < 0) + lr &= (1 << 16); + lr += lm; +} diff --git a/gcc/testsuite/gcc.target/loongarch/fnmam4-vec.c b/gcc/testsuite/gcc.target/loongarch/fnmam4-vec.c new file mode 100644 index 000000000000..09693039deb3 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/fnmam4-vec.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-Ofast -mlasx -ftree-vectorize" } */ +/* { dg-require-effective-target loongarch_asx } */ + +void +foo (float *u, float x, float *y, float z) +{ + int i; + for (i = 0; i < 1024; i++) + *(u++) = (x - y[i] * z); +} + +/* { dg-final { scan-assembler-not "\tvori.b"} } */ +/* { dg-final { scan-assembler-not "\txvori.b"} } */ diff --git a/gcc/testsuite/gcc.target/loongarch/pr122097.c b/gcc/testsuite/gcc.target/loongarch/pr122097.c new file mode 100644 index 000000000000..5d32b191baf1 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/pr122097.c @@ -0,0 +1,271 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -mabi=lp64d -mlsx" } */ +/* { dg-final { scan-assembler "vbitseti\.d\t\\\$vr\[0-9\]+,\\\$vr\[0-9\]+,63" } } */ + +typedef long unsigned int size_t; +typedef unsigned char simde__mmask8; +typedef long simde__m128i __attribute__ ((__aligned__ ((16)))) +__attribute__ ((__vector_size__ (16))) __attribute__ ((__may_alias__)); +typedef union +{ + + __attribute__ ((__aligned__ ((16)))) long i64 + __attribute__ ((__vector_size__ (16))) __attribute__ ((__may_alias__)); +} simde__m128i_private; +typedef double simde_float64; +typedef simde_float64 simde__m128d __attribute__ ((__aligned__ ((16)))) +__attribute__ ((__vector_size__ (16))) __attribute__ ((__may_alias__)); +typedef long int int_fast32_t; +typedef union +{ + + __attribute__ ((__aligned__ ((16)))) int_fast32_t i32f + __attribute__ ((__vector_size__ (16))) __attribute__ ((__may_alias__)); + __attribute__ ((__aligned__ ((16)))) long i64 + __attribute__ ((__vector_size__ (16))) __attribute__ ((__may_alias__)); + __attribute__ ((__aligned__ ((16)))) simde_float64 f64 + __attribute__ ((__vector_size__ (16))) __attribute__ ((__may_alias__)); +} simde__m128d_private; +__attribute__ ((__always_inline__)) inline static simde__m128d +simde__m128d_from_private (simde__m128d_private v) +{ + simde__m128d r; + __builtin_memcpy (&r, &v, sizeof (r)); + return r; +} + +__attribute__ ((__always_inline__)) inline static simde__m128d +simde_mm_set_pd (simde_float64 e1, simde_float64 e0) +{ + + simde__m128d_private r_; + r_.f64[0] = e0; + r_.f64[1] = e1; + + return simde__m128d_from_private (r_); +} +__attribute__ ((__always_inline__)) inline static simde__m128i +simde_mm_castpd_si128 (simde__m128d a) +{ + simde__m128i r; + __builtin_memcpy (&r, &a, sizeof (a)); + return r; +} + +__attribute__ ((__always_inline__)) inline static simde__m128i +simde__m128i_from_private (simde__m128i_private v) +{ + simde__m128i r; + __builtin_memcpy (&r, &v, sizeof (r)); + return r; +} + +__attribute__ ((__always_inline__)) inline static simde__m128i_private +simde__m128i_to_private (simde__m128i v) +{ + simde__m128i_private r; + __builtin_memcpy (&r, &v, sizeof (r)); + return r; +} +__attribute__ ((__always_inline__)) inline static simde__m128d +simde_mm_castsi128_pd (simde__m128i a) +{ + simde__m128d r; + __builtin_memcpy (&r, &a, sizeof (a)); + return r; +} + +__attribute__ ((__always_inline__)) inline static simde__m128i +simde_mm_mask_mov_epi64 (simde__m128i src, simde__mmask8 k, simde__m128i a) +{ + + simde__m128i_private src_ = simde__m128i_to_private (src), + a_ = simde__m128i_to_private (a), r_; + + for (size_t i = 0; i < (sizeof (r_.i64) / sizeof (r_.i64[0])); i++) + { + r_.i64[i] = ((k >> i) & 1) ? a_.i64[i] : src_.i64[i]; + } + + return simde__m128i_from_private (r_); +} + +__attribute__ ((__always_inline__)) inline static simde__m128d +simde_mm_mask_mov_pd (simde__m128d src, simde__mmask8 k, simde__m128d a) +{ + return simde_mm_castsi128_pd (simde_mm_mask_mov_epi64 ( + simde_mm_castpd_si128 (src), k, simde_mm_castpd_si128 (a))); +} + +static double +simde_test_f64_precision_to_slop (int precision) +{ + return __builtin_expect (!!(precision == 0x7fffffff), 0) + ? 0.0 + : __builtin_pow (10.0, -((double)(precision))); +} +__attribute__ ((__always_inline__)) inline static void +simde_mm_storeu_pd (simde_float64 *mem_addr, simde__m128d a) +{ + + __builtin_memcpy (mem_addr, &a, sizeof (a)); +} +int simde_test_equal_f64 (simde_float64 a, simde_float64 b, + simde_float64 slop); +void simde_test_debug_printf_ (const char *format, ...); +static int +simde_assert_equal_vf64_ (size_t vec_len, simde_float64 const a[(vec_len)], + simde_float64 const b[(vec_len)], simde_float64 slop, + const char *filename, int line, const char *astr, + const char *bstr) +{ + for (size_t i = 0; i < vec_len; i++) + { + if (__builtin_expect (!!(!simde_test_equal_f64 (a[i], b[i], slop)), 0)) + { + simde_test_debug_printf_ ( + "%s:%d: assertion failed: %s[%zu] ~= %s[%zu] (%f ~= %f)\n", + filename, line, astr, i, bstr, i, ((double)(a[i])), + ((double)(b[i]))); + return 1; + } + } + return 0; +} +static int +simde_test_x86_assert_equal_f64x2_ (simde__m128d a, simde__m128d b, + simde_float64 slop, const char *filename, + int line, const char *astr, + const char *bstr) +{ + simde_float64 a_[sizeof (a) / sizeof (simde_float64)], + b_[sizeof (a) / sizeof (simde_float64)]; + simde_mm_storeu_pd (a_, a); + simde_mm_storeu_pd (b_, b); + return simde_assert_equal_vf64_ (sizeof (a_) / sizeof (a_[0]), a_, b_, slop, + filename, line, astr, bstr); +} +__attribute__ ((__always_inline__)) inline static simde__m128d_private +simde__m128d_to_private (simde__m128d v) +{ + simde__m128d_private r; + __builtin_memcpy (&r, &v, sizeof (r)); + return r; +} +__attribute__ ((__always_inline__)) inline static simde__m128d +simde_mm_min_pd (simde__m128d a, simde__m128d b) +{ + + simde__m128d_private r_, a_ = simde__m128d_to_private (a), + b_ = simde__m128d_to_private (b); + + for (size_t i = 0; i < (sizeof (r_.f64) / sizeof (r_.f64[0])); i++) + { + r_.f64[i] = (a_.f64[i] < b_.f64[i]) ? a_.f64[i] : b_.f64[i]; + } + + return simde__m128d_from_private (r_); +} + +__attribute__ ((__always_inline__)) inline static simde__m128d +simde_mm_max_pd (simde__m128d a, simde__m128d b) +{ + + simde__m128d_private r_, a_ = simde__m128d_to_private (a), + b_ = simde__m128d_to_private (b); + + for (size_t i = 0; i < (sizeof (r_.f64) / sizeof (r_.f64[0])); i++) + { + r_.f64[i] = (a_.f64[i] > b_.f64[i]) ? a_.f64[i] : b_.f64[i]; + } + + return simde__m128d_from_private (r_); +} + +__attribute__ ((__always_inline__)) inline static simde__m128d +simde_x_mm_abs_pd (simde__m128d a) +{ + + simde__m128d_private r_, a_ = simde__m128d_to_private (a); + for (size_t i = 0; i < (sizeof (r_.f64) / sizeof (r_.f64[0])); i++) + { + r_.f64[i] = __builtin_fabs (a_.f64[i]); + } + + return simde__m128d_from_private (r_); +} +__attribute__ ((__always_inline__)) inline static simde__m128d +simde_mm_cmple_pd (simde__m128d a, simde__m128d b) +{ + + simde__m128d_private r_, a_ = simde__m128d_to_private (a), + b_ = simde__m128d_to_private (b); + + r_.i64 = ((__typeof__ (r_.i64))((a_.f64 <= b_.f64))); + return simde__m128d_from_private (r_); +} + +__attribute__ ((__always_inline__)) inline static simde__m128d +simde_x_mm_select_pd (simde__m128d a, simde__m128d b, simde__m128d mask) +{ + simde__m128d_private r_, a_ = simde__m128d_to_private (a), + b_ = simde__m128d_to_private (b), + mask_ = simde__m128d_to_private (mask); + + r_.i64 = a_.i64 ^ ((a_.i64 ^ b_.i64) & mask_.i64); + return simde__m128d_from_private (r_); +} +simde__m128d simde_mm_cmpge_pd (simde__m128d a, simde__m128d b); + +simde__m128d +simde_x_mm_copysign_pd (simde__m128d dest, simde__m128d src) +{ + simde__m128d_private r_, dest_ = simde__m128d_to_private (dest), + src_ = simde__m128d_to_private (src); + for (size_t i = 0; i < (sizeof (r_.f64) / sizeof (r_.f64[0])); i++) + { + r_.f64[i] = __builtin_copysign (dest_.f64[i], src_.f64[i]); + } + + return simde__m128d_from_private (r_); +} +simde__m128d simde_mm_or_pd (simde__m128d a, simde__m128d b); + +simde__m128d simde_mm_set1_pd (simde_float64 a); + +__attribute__ ((__always_inline__)) inline static simde__m128d +simde_mm_range_pd (simde__m128d a, simde__m128d b, int imm8) +{ + simde__m128d r; + + r = simde_x_mm_select_pd ( + b, a, simde_mm_cmple_pd (simde_x_mm_abs_pd (a), simde_x_mm_abs_pd (b))); + + r = simde_x_mm_copysign_pd (r, a); + + return r; +} +int +test_simde_mm_mask_range_pd (void) +{ + + simde__m128d src, a, b, e, r; + + src = simde_mm_set_pd (-2.92, -85.39); + a = simde_mm_set_pd (-47.59, -122.31); + b = simde_mm_set_pd (877.42, 69.15); + e = simde_mm_set_pd (-47.59, -69.15); + r = simde_mm_mask_mov_pd (src, 143, simde_mm_range_pd (a, b, 2)); + do + { + if (simde_test_x86_assert_equal_f64x2_ ( + r, e, simde_test_f64_precision_to_slop (1), + "../test/x86/avx512/range.c", 1454, "r", "e")) + { + return 1; + } + } + while (0); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/trap-1.c b/gcc/testsuite/gcc.target/loongarch/trap-1.c new file mode 100644 index 000000000000..8936f60cce20 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/trap-1.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -w -fisolate-erroneous-paths-dereference -mbreak-code=1" } */ +/* { dg-final { scan-assembler "break\\t1" } } */ + +int +bug (void) +{ + return *(int *)0; +} diff --git a/gcc/testsuite/gcc.target/loongarch/trap-default.c b/gcc/testsuite/gcc.target/loongarch/trap-default.c new file mode 100644 index 000000000000..32948d4c8227 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/trap-default.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -w -fisolate-erroneous-paths-dereference" } */ +/* { dg-final { scan-assembler "amswap\\.w\\t\\\$r0,\\\$r1,\\\$r0" } } */ + +int +bug (void) +{ + return *(int *)0; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr122445.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr122445.c new file mode 100644 index 000000000000..47368684faa1 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr122445.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcbv_zvl256b -mabi=lp64d -O3 -mrvv-vector-bits=zvl --param=riscv-autovec-mode=V4QI -mtune=generic-ooo -fdump-rtl-avlprop-all" } */ + +typedef unsigned char uint8_t; +typedef short int16_t; + +#define FDEC_STRIDE 32 + +static inline uint8_t x264_clip_uint8( int x ) +{ + return x; +} + +void +x264_add4x4_idct (uint8_t *p_dst, int16_t d[16]) +{ + for( int y = 0; y < 4; y++ ) + { + for( int x = 0; x < 4; x++ ) + p_dst[x] = x264_clip_uint8( p_dst[x] + d[y*4+x] ); + p_dst += FDEC_STRIDE; + } +} + +/* { dg-final { scan-rtl-dump "Propagating AVL: \\(const_int 4" "avlprop" } } */ +/* { dg-final { scan-rtl-dump-not "Propagating AVL: \\(const_int 1" "avlprop" } } */ diff --git a/gcc/testsuite/gfortran.dg/coarray_atomic_5.f90 b/gcc/testsuite/gfortran.dg/coarray_atomic_5.f90 index 70c3d2ff4eb6..8ddfa8df27c6 100644 --- a/gcc/testsuite/gfortran.dg/coarray_atomic_5.f90 +++ b/gcc/testsuite/gfortran.dg/coarray_atomic_5.f90 @@ -19,7 +19,7 @@ program atomic write(*,*) me end program -! { dg-final { scan-tree-dump-times "value.. = 0;" 1 "original" } } -! { dg-final { scan-tree-dump-times "_gfortran_caf_atomic_define \\(caf_token.., 0, 1, &value.., 0B, 1, 4\\);" 1 "original" } } +! { dg-final { scan-tree-dump-times "D\\.\[0-9\]+ = 0;" 1 "original" } } +! { dg-final { scan-tree-dump-times "_gfortran_caf_atomic_define \\(caf_token.., 0, 1, &D\\.\[0-9\]+, 0B, 1, 4\\);" 1 "original" } } ! { dg-final { scan-tree-dump-times "_gfortran_caf_atomic_op \\(1, caf_token.., 0, 1, &me, 0B, 0B, 1, 4\\);" 1 "original" } } ! { dg-final { scan-tree-dump-times "_gfortran_caf_atomic_ref \\(caf_token.., 0, 1, &me, 0B, 1, 4\\);" 1 "original" } } diff --git a/gcc/testsuite/gfortran.dg/pdt_62.f03 b/gcc/testsuite/gfortran.dg/pdt_62.f03 new file mode 100644 index 000000000000..efbcdad3ae7d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pdt_62.f03 @@ -0,0 +1,78 @@ +! { dg-do run } +! +! Test fix for PR122433 +! +! Contributed by Damian Rouson +! +module neuron_m + implicit none + + type string_t + character(len=:), allocatable :: string_ + end type + + type neuron_t(k) + integer, kind :: k = kind(1.) + real(k) bias_ + type(neuron_t(k)), allocatable :: next + end type + +contains + recursive function from_json(neuron_lines, start) result(neuron) + type(string_t) neuron_lines(:) + integer start + type(neuron_t) neuron + character(len=:), allocatable :: line + line = neuron_lines(start+1)%string_ + read(line(index(line, ":")+1:), fmt=*) neuron%bias_ + line = adjustr(neuron_lines(start+3)%string_) +! Used to give "Error: Syntax error in IF-clause" for next line. + if (line(len(line):) == ",") neuron%next = from_json(neuron_lines, start+4) + end function + recursive function from_json_8(neuron_lines, start) result(neuron) + type(string_t) neuron_lines(:) + integer start + type(neuron_t(kind(1d0))) neuron + character(len=:), allocatable :: line + line = neuron_lines(start+1)%string_ + read(line(index(line, ":")+1:), fmt=*) neuron%bias_ + line = adjustr(neuron_lines(start+3)%string_) + if (line(len(line):) == ",") neuron%next = from_json_8(neuron_lines, start+4) + end function +end module + + use neuron_m + call foo + call bar +contains + subroutine foo + type(neuron_t) neuron + type(string_t) :: neuron_lines(8) + neuron_lines(2)%string_ = "real : 4.0 " + neuron_lines(4)%string_ = " ," + neuron_lines(6)%string_ = "real : 8.0 " + neuron_lines(8)%string_ = " " + neuron = from_json(neuron_lines, 1) + if (int (neuron%bias_) /= 4) stop 1 + if (allocated (neuron%next)) then + if (int (neuron%next%bias_) /= 8) stop 2 + else + stop 3 + endif + end subroutine + subroutine bar + type(neuron_t(kind(1d0))) neuron + type(string_t) :: neuron_lines(8) + neuron_lines(2)%string_ = "real : 4.0d0 " + neuron_lines(4)%string_ = " ," + neuron_lines(6)%string_ = "real : 8.0d0 " + neuron_lines(8)%string_ = " " + neuron = from_json_8(neuron_lines, 1) + if (int (neuron%bias_) /= 4) stop 1 + if (allocated (neuron%next)) then + if (int (neuron%next%bias_) /= 8) stop 2 + else + stop 3 + endif + end subroutine +end diff --git a/gcc/testsuite/gfortran.dg/pdt_63.f03 b/gcc/testsuite/gfortran.dg/pdt_63.f03 new file mode 100644 index 000000000000..127e5fe8eb8d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pdt_63.f03 @@ -0,0 +1,26 @@ +! { dg-do compile } +! +! Test fix for PR122434 +! +! Contributed by Damian Rouson +! +module neuron_m + implicit none + + type neuron_t + real, allocatable :: weight_ + end type + + interface + type(neuron_t) pure module function from_json() result(neuron) + end function + end interface + +contains + module procedure from_json + associate(num_inputs => 1) +! Gave "Error: Bad allocate-object at (1) for a PURE procedure" in next line. + allocate(neuron%weight_, source=0.) + end associate + end procedure +end module diff --git a/gcc/testsuite/gfortran.dg/pdt_64.f03 b/gcc/testsuite/gfortran.dg/pdt_64.f03 new file mode 100644 index 000000000000..dfa4e3aaa1fc --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pdt_64.f03 @@ -0,0 +1,17 @@ +! { dg-do compile } +! +! Test the fix for PR122165. +! +! Contributed by Steve Kargl +! +program foo + implicit none + type dt(k,l) + integer(8), len :: k = 1 + integer(8), KIND :: l = 1 + character(k) :: arr + end type + type(dt(:)), allocatable :: d1 + if (d1%k%kind /= 8) stop 1 ! { dg-error "cannot be followed by the type inquiry ref" } + if (d1%l%kind /= 8) stop 2 ! { dg-error "cannot be followed by the type inquiry ref" } +end diff --git a/gcc/testsuite/gfortran.dg/pdt_65.f03 b/gcc/testsuite/gfortran.dg/pdt_65.f03 new file mode 100644 index 000000000000..d5e45c290ae1 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pdt_65.f03 @@ -0,0 +1,135 @@ +! { dg-do compile } +! { dg-options "-fdump-tree-original" } +! +! Test fix for PR122452 +! +! Contributed by Damian Rouson +! +module kind_parameters_m + integer, parameter :: default_real = kind(1e0) + integer, parameter :: double_precision = kind(1d0) +end module + +module tensor_m + use kind_parameters_m, only : default_real, double_precision + implicit none + + private + public :: tensor_t + + type tensor_t(k) + integer, kind :: k = default_real + real(k), allocatable, private :: values_(:) + contains + generic :: values => default_real_values, double_precision_values + procedure, private, non_overridable :: default_real_values, double_precision_values + generic :: num_components => default_real_num_components, double_precision_num_components + procedure, private :: default_real_num_components, double_precision_num_components + end type + + interface tensor_t + + pure module function construct_default_real(values) result(tensor) + implicit none + real, intent(in) :: values(:) + type(tensor_t) tensor + end function + + pure module function construct_double_precision(values) result(tensor) + implicit none + double precision, intent(in) :: values(:) + type(tensor_t(double_precision)) tensor + end function + + end interface + + interface + + pure module function default_real_values(self) result(tensor_values) + implicit none + class(tensor_t), intent(in) :: self + real, allocatable :: tensor_values(:) + end function + + pure module function double_precision_values(self) result(tensor_values) + implicit none + class(tensor_t(double_precision)), intent(in) :: self + double precision, allocatable :: tensor_values(:) + end function + + pure module function default_real_num_components(self) result(n) + implicit none + class(tensor_t), intent(in) :: self + integer n + end function + + pure module function double_precision_num_components(self) result(n) + implicit none + class(tensor_t(double_precision)), intent(in) :: self + integer n + end function + + end interface + +end module tensor_m + +submodule(tensor_m) tensor_s +contains + + pure module function construct_default_real(values) result(tensor) + implicit none + real, intent(in) :: values(:) + type(tensor_t) tensor + tensor = tensor_t ()(values) + end function + + pure module function construct_double_precision(values) result(tensor) + implicit none + double precision, intent(in) :: values(:) + type(tensor_t(double_precision)) tensor + tensor = tensor_t (double_precision)(values) + end function + + pure module function default_real_values(self) result(tensor_values) + implicit none + class(tensor_t), intent(in) :: self + real, allocatable :: tensor_values(:) + tensor_values = self%values_ + end function + + pure module function double_precision_values(self) result(tensor_values) + implicit none + class(tensor_t(double_precision)), intent(in) :: self + double precision, allocatable :: tensor_values(:) + tensor_values = self%values_ + end function + + + pure module function default_real_num_components(self) result(n) + implicit none + class(tensor_t), intent(in) :: self + integer n + n = default_real + end function + + pure module function double_precision_num_components(self) result(n) + implicit none + class(tensor_t(double_precision)), intent(in) :: self + integer n + n = double_precision + end function + +end submodule tensor_s + + + use tensor_m + type(tensor_t(kind(0e0))) :: a + type(tensor_t(kind(0D0))) :: b + a = tensor_t ([1e0,2e0]) + print *, a%num_components (), a%values () + b = tensor_t ([3d0,4d0]) + print *, b%num_components (), b%values () +end +! { dg-final { scan-tree-dump-times "construct_" 4 "original" } } +! { dg-final { scan-tree-dump-times "_components" 4 "original" } } +! { dg-final { scan-tree-dump-times "_values" 4 "original" } } diff --git a/gcc/testsuite/gfortran.dg/team_form_3.f90 b/gcc/testsuite/gfortran.dg/team_form_3.f90 index d9aae3376ead..13eb0c099954 100644 --- a/gcc/testsuite/gfortran.dg/team_form_3.f90 +++ b/gcc/testsuite/gfortran.dg/team_form_3.f90 @@ -29,6 +29,6 @@ ! { dg-final { scan-tree-dump "_gfortran_caf_form_team \\(new_team, &team, 0B, 0B, 0B, 0\\)" "original" } } ! { dg-final { scan-tree-dump "_gfortran_caf_form_team \\(new_team, &team, 0B, &istat, 0B, 0\\)" "original" } } ! { dg-final { scan-tree-dump "_gfortran_caf_form_team \\(new_team, &team, 0B, &istat, &err, 30\\)" "original" } } -! { dg-final { scan-tree-dump "_gfortran_caf_form_team \\(new_team, &team, &C\\.\[0-9\]+, 0B, 0B, 0\\)" "original" } } -! { dg-final { scan-tree-dump "_gfortran_caf_form_team \\(new_team, &team, &C\\.\[0-9\]+, &istat, 0B, 0\\)" "original" } } -! { dg-final { scan-tree-dump "_gfortran_caf_form_team \\(new_team, &team, &C\\.\[0-9\]+, &istat, &err, 30\\)" "original" } } +! { dg-final { scan-tree-dump "_gfortran_caf_form_team \\(new_team, &team, &D\\.\[0-9\]+, 0B, 0B, 0\\)" "original" } } +! { dg-final { scan-tree-dump "_gfortran_caf_form_team \\(new_team, &team, &D\\.\[0-9\]+, &istat, 0B, 0\\)" "original" } } +! { dg-final { scan-tree-dump "_gfortran_caf_form_team \\(new_team, &team, &D\\.\[0-9\]+, &istat, &err, 30\\)" "original" } } diff --git a/gcc/testsuite/gfortran.dg/vect/pr70102.f b/gcc/testsuite/gfortran.dg/vect/pr70102.f new file mode 100644 index 000000000000..b6a2878a06e4 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/vect/pr70102.f @@ -0,0 +1,21 @@ +! { dg-do compile } +! { dg-additional-options "-Ofast" } + subroutine test (x,y,z) + integer x,y,z + real*8 a(5,x,y,z),b(5,x,y,z) + real*8 c + + c = 0.0d0 + do k=1,z + do j=1,y + do i=1,x + do l=1,5 + c = c + a(l,i,j,k)*b(l,i,j,k) + enddo + enddo + enddo + enddo + write(30,*)'c ==',c + return + end +! { dg-final { scan-tree-dump "vectorizing a reduction chain" "vect" { target vect_double } } } diff --git a/gcc/testsuite/gm2.dg/spell/iso/fail/badimport.mod b/gcc/testsuite/gm2.dg/spell/iso/fail/badimport.mod new file mode 100644 index 000000000000..337cf346d50f --- /dev/null +++ b/gcc/testsuite/gm2.dg/spell/iso/fail/badimport.mod @@ -0,0 +1,14 @@ + +(* { dg-do compile } *) +(* { dg-options "-g -c" } *) + +MODULE badimport ; + +IMPORT ASCII ; +FROM StrIO IMPORT WriteString ; +FROM ASCIi IMPORT nul ; + (* { dg-error "error: the file containing the definition module 'ASCIi' cannot be found, did you mean ASCII" "ASCIi" { target *-*-* } 9 } *) + +BEGIN + +END badimport. diff --git a/gcc/testsuite/gnat.dg/aggr32.adb b/gcc/testsuite/gnat.dg/aggr32.adb new file mode 100644 index 000000000000..e5b0887f59c9 --- /dev/null +++ b/gcc/testsuite/gnat.dg/aggr32.adb @@ -0,0 +1,15 @@ +-- { dg-do compile } + +with Aggr32_Pkg.Child; + +procedure Aggr32 (W, H : Positive) is + + use Aggr32_Pkg; + + package Test_1 is new Child (Frame => (Width => W, Height => H)); + + package Test_2 is new Child (Frame => Rec'(Width => W, Height => H)); + +begin + null; +end; diff --git a/gcc/testsuite/gnat.dg/aggr32_pkg-child.ads b/gcc/testsuite/gnat.dg/aggr32_pkg-child.ads new file mode 100644 index 000000000000..352e2b518e1f --- /dev/null +++ b/gcc/testsuite/gnat.dg/aggr32_pkg-child.ads @@ -0,0 +1,6 @@ +generic + + Frame : Rec; + +package Aggr32_Pkg.Child is +end Aggr32_Pkg.Child; diff --git a/gcc/testsuite/gnat.dg/aggr32_pkg.ads b/gcc/testsuite/gnat.dg/aggr32_pkg.ads new file mode 100644 index 000000000000..e0e8bef9837f --- /dev/null +++ b/gcc/testsuite/gnat.dg/aggr32_pkg.ads @@ -0,0 +1,8 @@ +package Aggr32_Pkg is + + type Rec is record + Width : Positive; + Height : Positive; + end record; + +end Aggr32_Pkg; diff --git a/gcc/testsuite/gnat.dg/specs/generic_inst3.ads b/gcc/testsuite/gnat.dg/specs/generic_inst3.ads index 4f31d61f0cc0..262bdb77a06f 100644 --- a/gcc/testsuite/gnat.dg/specs/generic_inst3.ads +++ b/gcc/testsuite/gnat.dg/specs/generic_inst3.ads @@ -1,3 +1,5 @@ +-- { dg-do compile } + with Generic_Inst3_Pkg1; package Generic_Inst3 is new Generic_Inst3_Pkg1; diff --git a/gcc/testsuite/gnat.dg/specs/generic_inst4-child1.ads b/gcc/testsuite/gnat.dg/specs/generic_inst4-child1.ads new file mode 100644 index 000000000000..2e5d7ef2a61b --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/generic_inst4-child1.ads @@ -0,0 +1,6 @@ +generic + + with procedure Proc is <>; + +package Generic_Inst4.Child1 is +end Generic_Inst4.Child1; diff --git a/gcc/testsuite/gnat.dg/specs/generic_inst4-child2.ads b/gcc/testsuite/gnat.dg/specs/generic_inst4-child2.ads new file mode 100644 index 000000000000..c84709e60649 --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/generic_inst4-child2.ads @@ -0,0 +1,5 @@ +-- { dg-do compile } + +with Generic_Inst4.Child1; + +package Generic_Inst4.Child2 is new Generic_Inst4.Child1; diff --git a/gcc/testsuite/gnat.dg/specs/generic_inst4.ads b/gcc/testsuite/gnat.dg/specs/generic_inst4.ads new file mode 100644 index 000000000000..01e4ad4bf6ef --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/generic_inst4.ads @@ -0,0 +1,5 @@ +package Generic_Inst4 is + + procedure Proc is null; + +end Generic_Inst4; diff --git a/gcc/testsuite/gnat.dg/specs/generic_inst5.ads b/gcc/testsuite/gnat.dg/specs/generic_inst5.ads new file mode 100644 index 000000000000..d3d0b2a2783b --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/generic_inst5.ads @@ -0,0 +1,14 @@ +-- { dg-do compile } + +with Ada.Containers.Ordered_Sets; +with Generic_Inst5_Pkg1; +with Generic_Inst5_Pkg2; + +package Generic_Inst5 is + + package Charsets is new Ada.Containers.Ordered_sets (Character); + package P1 is new Generic_Inst5_Pkg1 (Charsets); + package P1_N is new P1.Nested; + package P2 is new Generic_Inst5_Pkg2 (P1, P1_N); + +end Generic_Inst5; diff --git a/gcc/testsuite/gnat.dg/specs/generic_inst5_pkg1.ads b/gcc/testsuite/gnat.dg/specs/generic_inst5_pkg1.ads new file mode 100644 index 000000000000..da599b053f7f --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/generic_inst5_pkg1.ads @@ -0,0 +1,9 @@ +with Ada.Containers.Ordered_Sets; + +generic + with package Sets is new Ada.Containers.Ordered_Sets (<>); +package Generic_Inst5_Pkg1 is + generic + package Nested is + end Nested; +end Generic_Inst5_Pkg1; diff --git a/gcc/testsuite/gnat.dg/specs/generic_inst5_pkg2.ads b/gcc/testsuite/gnat.dg/specs/generic_inst5_pkg2.ads new file mode 100644 index 000000000000..2f5df87d19eb --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/generic_inst5_pkg2.ads @@ -0,0 +1,7 @@ +with Generic_Inst5_Pkg1; + +generic + with package P1 is new Generic_Inst5_Pkg1 (<>); + with package P1_N is new P1.Nested; +package Generic_Inst5_Pkg2 is +end Generic_Inst5_Pkg2; diff --git a/gcc/testsuite/gnat.dg/specs/generic_inst6.ads b/gcc/testsuite/gnat.dg/specs/generic_inst6.ads new file mode 100644 index 000000000000..0f15207cbf92 --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/generic_inst6.ads @@ -0,0 +1,6 @@ +-- { dg-do compile } + +with Generic_Inst6_Pkg1.Child.Grand2; +with Generic_Inst6_Pkg3; + +package Generic_Inst6 is new Generic_Inst6_Pkg3.Grand2; diff --git a/gcc/testsuite/gnat.dg/specs/generic_inst6_pkg1-child-grand1.ads b/gcc/testsuite/gnat.dg/specs/generic_inst6_pkg1-child-grand1.ads new file mode 100644 index 000000000000..4d8e7cec85af --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/generic_inst6_pkg1-child-grand1.ads @@ -0,0 +1,3 @@ +generic +package Generic_Inst6_Pkg1.Child.Grand1 is +end Generic_Inst6_Pkg1.Child.Grand1; diff --git a/gcc/testsuite/gnat.dg/specs/generic_inst6_pkg1-child-grand2.ads b/gcc/testsuite/gnat.dg/specs/generic_inst6_pkg1-child-grand2.ads new file mode 100644 index 000000000000..326a3e0d6670 --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/generic_inst6_pkg1-child-grand2.ads @@ -0,0 +1,6 @@ +with Generic_Inst6_Pkg1.Child.Grand1; + +generic +package Generic_Inst6_Pkg1.Child.Grand2 is + package My_Grand1 is new Generic_Inst6_Pkg1.Child.Grand1; +end Generic_Inst6_Pkg1.Child.Grand2; diff --git a/gcc/testsuite/gnat.dg/specs/generic_inst6_pkg1-child.ads b/gcc/testsuite/gnat.dg/specs/generic_inst6_pkg1-child.ads new file mode 100644 index 000000000000..367605266ff7 --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/generic_inst6_pkg1-child.ads @@ -0,0 +1,3 @@ +generic +package Generic_Inst6_Pkg1.Child is +end Generic_Inst6_Pkg1.Child; diff --git a/gcc/testsuite/gnat.dg/specs/generic_inst6_pkg1.ads b/gcc/testsuite/gnat.dg/specs/generic_inst6_pkg1.ads new file mode 100644 index 000000000000..a480bbd3fc63 --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/generic_inst6_pkg1.ads @@ -0,0 +1,3 @@ +generic +package Generic_Inst6_Pkg1 is +end Generic_Inst6_Pkg1; diff --git a/gcc/testsuite/gnat.dg/specs/generic_inst6_pkg2.ads b/gcc/testsuite/gnat.dg/specs/generic_inst6_pkg2.ads new file mode 100644 index 000000000000..98b201117bfd --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/generic_inst6_pkg2.ads @@ -0,0 +1,3 @@ +with Generic_Inst6_Pkg1; + +package Generic_Inst6_Pkg2 is new Generic_Inst6_Pkg1; diff --git a/gcc/testsuite/gnat.dg/specs/generic_inst6_pkg3.ads b/gcc/testsuite/gnat.dg/specs/generic_inst6_pkg3.ads new file mode 100644 index 000000000000..395b9f0cb96e --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/generic_inst6_pkg3.ads @@ -0,0 +1,4 @@ +with Generic_Inst6_Pkg1.Child; +with Generic_Inst6_Pkg2; + +package Generic_Inst6_Pkg3 is new Generic_Inst6_Pkg2.Child; diff --git a/gcc/testsuite/gnat.dg/specs/generic_inst7.ads b/gcc/testsuite/gnat.dg/specs/generic_inst7.ads new file mode 100644 index 000000000000..3132525dc41d --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/generic_inst7.ads @@ -0,0 +1,17 @@ +-- { dg-do compile } + +package Generic_Inst7 is + + function F return Integer is (0); + + generic + with function Foo return Integer; + package P is + type Color is (Foo); + end P; + + package My_P is new P (F); + + I : Integer := My_P.Foo; -- { dg-error "expected type|found type" } + +end Generic_Inst7; diff --git a/gcc/testsuite/gnat.dg/specs/generic_inst8.ads b/gcc/testsuite/gnat.dg/specs/generic_inst8.ads new file mode 100644 index 000000000000..0eac70947235 --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/generic_inst8.ads @@ -0,0 +1,18 @@ +-- { dg-do compile } + +package Generic_Inst8 is + + function F return Integer is (0); + + generic + with function Foo return Integer; + package P is + type Color1 is (Foo); + type Color2 is (Foo); + end P; + + package My_P is new P (F); + + I : Integer := My_P.Foo; -- { dg-error "no visible interpretation|use" } + +end Generic_Inst8; diff --git a/gcc/testsuite/gnat.dg/specs/private3-child.ads b/gcc/testsuite/gnat.dg/specs/private3-child.ads new file mode 100644 index 000000000000..0367302eef33 --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/private3-child.ads @@ -0,0 +1,11 @@ +-- { dg-do compile } + +generic + + type Ext is new T with private; + +package Private3.Child is + + procedure P_Private (X : in out Ext) is null; + +end Private3.Child; diff --git a/gcc/testsuite/gnat.dg/specs/private3.ads b/gcc/testsuite/gnat.dg/specs/private3.ads new file mode 100644 index 000000000000..558246caf2ee --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/private3.ads @@ -0,0 +1,9 @@ +package Private3 is + + type T is tagged null record; + +private + + procedure P_Private (X : in out T) is null; + +end Private3; diff --git a/gcc/tree-scalar-evolution.cc b/gcc/tree-scalar-evolution.cc index ecdef7529a63..9f82abc4b81f 100644 --- a/gcc/tree-scalar-evolution.cc +++ b/gcc/tree-scalar-evolution.cc @@ -3949,11 +3949,6 @@ final_value_replacement_loop (class loop *loop) auto loc = gimple_phi_arg_location (phi, exit->dest_idx); remove_phi_node (&psi, false); - /* Propagate constants immediately, but leave an unused initialization - around to avoid invalidating the SCEV cache. */ - if (CONSTANT_CLASS_P (def) && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rslt)) - replace_uses_by (rslt, def); - /* Create the replacement statements. */ gimple_seq stmts; def = force_gimple_operand (def, &stmts, false, NULL_TREE); @@ -3961,6 +3956,11 @@ final_value_replacement_loop (class loop *loop) gimple_set_location (ass, loc); gimple_seq_add_stmt (&stmts, ass); + /* Propagate constants immediately, but leave an unused initialization + around to avoid invalidating the SCEV cache. */ + if (CONSTANT_CLASS_P (def) && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rslt)) + replace_uses_by (rslt, def); + /* If def's type has undefined overflow and there were folded casts, rewrite all stmts added for def into arithmetics with defined overflow behavior. */ @@ -3995,11 +3995,17 @@ final_value_replacement_loop (class loop *loop) { gimple *use_stmt; imm_use_iterator imm_iter; + auto_vec to_fold; FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, rslt) + if (!stmt_can_throw_internal (cfun, use_stmt)) + to_fold.safe_push (use_stmt); + /* Delay folding until after the immediate use walk is completed + as we have an active ranger and that might walk immediate + uses of rslt again. See PR122502. */ + for (gimple *use_stmt : to_fold) { gimple_stmt_iterator gsi = gsi_for_stmt (use_stmt); - if (!stmt_can_throw_internal (cfun, use_stmt) - && fold_stmt (&gsi, follow_all_ssa_edges)) + if (fold_stmt (&gsi, follow_all_ssa_edges)) update_stmt (gsi_stmt (gsi)); } } diff --git a/gcc/tree-ssa-forwprop.cc b/gcc/tree-ssa-forwprop.cc index 79ac25f7ed57..9a993ab04de3 100644 --- a/gcc/tree-ssa-forwprop.cc +++ b/gcc/tree-ssa-forwprop.cc @@ -216,31 +216,6 @@ static bitmap to_purge; /* Const-and-copy lattice. */ static vec lattice; -/* forwprop_may_propagate_copy is like may_propagate_copy except - after the final folding, don't allow propagating of pointer ORIG - that have a lower alignment than the DEST name. - This is to prevent losing alignment information from - __builtin_assume_aligned for expand (See also PR 122086). */ -static bool -forwprop_may_propagate_copy (tree dest, tree orig, - bool dest_not_abnormal_phi_edge_p = false) -{ - if (!may_propagate_copy (dest, orig, dest_not_abnormal_phi_edge_p)) - return false; - - /* Only check alignment for the final folding. */ - if (!(cfun->curr_properties & PROP_last_full_fold)) - return true; - - /* Alignment only matters for pointer types. */ - if (!POINTER_TYPE_P (TREE_TYPE (dest)) || !POINTER_TYPE_P (TREE_TYPE (orig))) - return true; - - unsigned aligndest = get_pointer_alignment (dest); - unsigned alignorig = get_pointer_alignment (orig); - return aligndest <= alignorig; -} - /* Set the lattice entry for NAME to VAL. */ static void fwprop_set_lattice_val (tree name, tree val) @@ -1818,6 +1793,7 @@ do_simple_agr_dse (gassign *stmt, bool full_walk) /* Only handle clobbers of a full decl. */ if (!DECL_P (lhs)) return; + clobber_kind kind = (clobber_kind)CLOBBER_KIND (gimple_assign_rhs1 (stmt)); ao_ref_init (&read, lhs); tree vuse = gimple_vuse (stmt); unsigned limit = full_walk ? param_sccvn_max_alias_queries_per_access : 4; @@ -1839,6 +1815,25 @@ do_simple_agr_dse (gassign *stmt, bool full_walk) basic_block ubb = gimple_bb (use_stmt); if (stmt == use_stmt) continue; + /* If the use is the same kind of clobber for lhs, + then it can be safely skipped; this happens with eh + and sometimes jump threading. */ + if (gimple_clobber_p (use_stmt, kind) + && lhs == gimple_assign_lhs (use_stmt)) + continue; + /* If the use is a phi and it is single use then check if that single use + is a clobber of the same kind and lhs is the same. */ + if (gphi *use_phi = dyn_cast(use_stmt)) + { + use_operand_p ou; + gimple *ostmt; + if (single_imm_use (gimple_phi_result (use_phi), &ou, &ostmt) + && gimple_clobber_p (ostmt, kind) + && lhs == gimple_assign_lhs (ostmt)) + continue; + /* A phi node will never be dominating the clobber. */ + return; + } /* The use needs to be dominating the clobber. */ if ((ubb != bb && !dominated_by_p (CDI_DOMINATORS, bb, ubb)) || ref_maybe_used_by_stmt_p (use_stmt, &read, false)) @@ -5202,7 +5197,7 @@ pass_forwprop::execute (function *fun) } if (all_same) { - if (forwprop_may_propagate_copy (res, first)) + if (may_propagate_copy (res, first)) to_remove_defs.safe_push (SSA_NAME_VERSION (res)); fwprop_set_lattice_val (res, first); } @@ -5557,7 +5552,7 @@ pass_forwprop::execute (function *fun) { if (!is_gimple_debug (stmt)) bitmap_set_bit (simple_dce_worklist, SSA_NAME_VERSION (use)); - if (forwprop_may_propagate_copy (use, val)) + if (may_propagate_copy (use, val)) { propagate_value (usep, val); substituted_p = true; @@ -5720,7 +5715,7 @@ pass_forwprop::execute (function *fun) /* If we can propagate the lattice-value mark the stmt for removal. */ if (val != lhs - && forwprop_may_propagate_copy (lhs, val)) + && may_propagate_copy (lhs, val)) to_remove_defs.safe_push (SSA_NAME_VERSION (lhs)); fwprop_set_lattice_val (lhs, val); } @@ -5742,7 +5737,7 @@ pass_forwprop::execute (function *fun) continue; tree val = fwprop_ssa_val (arg); if (val != arg - && forwprop_may_propagate_copy (arg, val, !(e->flags & EDGE_ABNORMAL))) + && may_propagate_copy (arg, val, !(e->flags & EDGE_ABNORMAL))) propagate_value (use_p, val); } diff --git a/gcc/tree-ssa-loop-niter.cc b/gcc/tree-ssa-loop-niter.cc index 6e1308625491..cc763839edcd 100644 --- a/gcc/tree-ssa-loop-niter.cc +++ b/gcc/tree-ssa-loop-niter.cc @@ -2321,6 +2321,48 @@ is_rshift_by_1 (gassign *stmt) return false; } +/* Helper for number_of_iterations_cltz that uses ranger to determine + if SRC's range, shifted left (when LEFT_SHIFT is true) or right + by NUM_IGNORED_BITS, is guaranteed to be != 0 on LOOP's preheader + edge. + Return true if so or false otherwise. */ + +static bool +shifted_range_nonzero_p (loop_p loop, tree src, + bool left_shift, int num_ignored_bits) +{ + int_range_max r (TREE_TYPE (src)); + gcc_assert (num_ignored_bits >= 0); + + if (get_range_query (cfun)->range_on_edge + (r, loop_preheader_edge (loop), src) + && !r.varying_p () + && !r.undefined_p ()) + { + if (num_ignored_bits) + { + range_op_handler op (left_shift ? LSHIFT_EXPR : RSHIFT_EXPR); + int_range_max shifted_range (TREE_TYPE (src)); + wide_int shift_count = wi::shwi (num_ignored_bits, + TYPE_PRECISION (TREE_TYPE + (src))); + int_range_max shift_amount + (TREE_TYPE (src), shift_count, shift_count); + + if (op.fold_range (shifted_range, TREE_TYPE (src), r, + shift_amount)) + r = shifted_range; + } + + /* If the range does not contain zero we are good. */ + if (!range_includes_zero_p (r)) + return true; + } + + return false; +} + + /* See comment below for number_of_iterations_bitcount. For c[lt]z, we have: @@ -2438,6 +2480,9 @@ number_of_iterations_cltz (loop_p loop, edge exit, tree src = gimple_phi_arg_def (phi, loop_preheader_edge (loop)->dest_idx); int src_precision = TYPE_PRECISION (TREE_TYPE (src)); + /* Save the original SSA name before preprocessing for ranger queries. */ + tree unshifted_src = src; + /* Apply any needed preprocessing to src. */ int num_ignored_bits; if (left_shift) @@ -2463,10 +2508,52 @@ number_of_iterations_cltz (loop_p loop, edge exit, expr = fold_convert (unsigned_type_node, expr); - tree assumptions = fold_build2 (NE_EXPR, boolean_type_node, src, - build_zero_cst (TREE_TYPE (src))); + /* If the copy-header (ch) pass peeled one iteration we're shifting + SRC by preprocessing it above. + + A loop like + if (bits) + { + while (!(bits & 1)) + { + bits >>= 1; + cnt += 1; + } + return cnt; + } + ch (roughly) transforms into: + if (bits) + { + if (!(bits & 1) + { + do + { + bits >>= 1; + cnt += 1; + } while (!(bits & 1)); + } + else + cnt = 1; + return cnt; + } + + Then, our preprocessed SRC (that is used for c[tl]z computation) + will be bits >> 1, and the assumption is bits >> 1 != 0. */ + + tree assumptions; + if (shifted_range_nonzero_p (loop, unshifted_src, + left_shift, num_ignored_bits)) + assumptions = boolean_true_node; + else + { + /* If ranger couldn't prove the assumption, try + simplify_using_initial_conditions. */ + assumptions = fold_build2 (NE_EXPR, boolean_type_node, src, + build_zero_cst (TREE_TYPE (src))); + assumptions = simplify_using_initial_conditions (loop, assumptions); + } - niter->assumptions = simplify_using_initial_conditions (loop, assumptions); + niter->assumptions = assumptions; niter->may_be_zero = boolean_false_node; niter->niter = simplify_using_initial_conditions (loop, expr); diff --git a/gcc/tree-ssa-loop.cc b/gcc/tree-ssa-loop.cc index 5629524afb2f..dc4b560e9245 100644 --- a/gcc/tree-ssa-loop.cc +++ b/gcc/tree-ssa-loop.cc @@ -28,6 +28,7 @@ along with GCC; see the file COPYING3. If not see #include "tm_p.h" #include "fold-const.h" #include "gimple-iterator.h" +#include "gimple-range.h" #include "tree-ssa-loop-ivopts.h" #include "tree-ssa-loop-manip.h" #include "tree-ssa-loop-niter.h" @@ -404,11 +405,15 @@ pass_scev_cprop::execute (function *) { bool any = false; + enable_ranger (cfun); + /* Perform final value replacement in loops, in case the replacement expressions are cheap. */ for (auto loop : loops_list (cfun, LI_FROM_INNERMOST)) any |= final_value_replacement_loop (loop); + disable_ranger (cfun); + return any ? TODO_cleanup_cfg | TODO_update_ssa_only_virtuals : 0; } diff --git a/gcc/tree-ssanames.cc b/gcc/tree-ssanames.cc index b6ca8809dc95..dcf8da56272d 100644 --- a/gcc/tree-ssanames.cc +++ b/gcc/tree-ssanames.cc @@ -611,15 +611,15 @@ get_known_nonzero_bits (const_tree name) return get_known_nonzero_bits_1 (name); } -/* Return TRUE is OP, an SSA_NAME has a range of values [0..1], false - otherwise. +/* Return TRUE is OP, an SSA_NAME has a range of values [0..1] at the + STMT, false otherwise. This can be because it is a boolean type, any unsigned integral type with a single bit of precision, or has known range of [0..1] via range analysis. */ bool -ssa_name_has_boolean_range (tree op) +ssa_name_has_boolean_range (tree op, gimple *stmt) { gcc_assert (TREE_CODE (op) == SSA_NAME); @@ -636,7 +636,7 @@ ssa_name_has_boolean_range (tree op) && (TYPE_PRECISION (TREE_TYPE (op)) > 1)) { int_range<2> r; - if (get_range_query (cfun)->range_of_expr (r, op) + if (get_range_query (cfun)->range_of_expr (r, op, stmt) && r == range_true_and_false (TREE_TYPE (op))) return true; diff --git a/gcc/tree-ssanames.h b/gcc/tree-ssanames.h index 7d2a8f940490..a6c603f88055 100644 --- a/gcc/tree-ssanames.h +++ b/gcc/tree-ssanames.h @@ -62,7 +62,7 @@ extern void set_nonzero_bits (tree, const wide_int &); extern void set_bitmask (tree, const wide_int &value, const wide_int &mask); extern wide_int get_nonzero_bits (const_tree); extern wide_int get_known_nonzero_bits (const_tree); -extern bool ssa_name_has_boolean_range (tree); +extern bool ssa_name_has_boolean_range (tree, gimple * = nullptr); extern void init_ssanames (struct function *, int); extern void fini_ssanames (struct function *); extern void ssanames_print_statistics (void); diff --git a/gcc/tree-vect-generic.cc b/gcc/tree-vect-generic.cc index 3c68361870bf..b8e6a7168ff4 100644 --- a/gcc/tree-vect-generic.cc +++ b/gcc/tree-vect-generic.cc @@ -460,7 +460,8 @@ expand_vector_comparison (gimple_stmt_iterator *gsi, tree type, tree op0, of OP0 with shift counts in SHIFTCNTS array and return the temporary holding the result if successful, otherwise return NULL_TREE. */ static tree -add_rshift (gimple_stmt_iterator *gsi, tree type, tree op0, int *shiftcnts) +add_shift (gimple_stmt_iterator *gsi, tree type, tree op0, int *shiftcnts, + enum tree_code code) { optab op; unsigned int i, nunits = nunits_for_known_piecewise_op (type); @@ -477,26 +478,47 @@ add_rshift (gimple_stmt_iterator *gsi, tree type, tree op0, int *shiftcnts) if (scalar_shift) { - op = optab_for_tree_code (RSHIFT_EXPR, type, optab_scalar); + op = optab_for_tree_code (code, type, optab_scalar); if (op != unknown_optab && can_implement_p (op, TYPE_MODE (type))) - return gimplify_build2 (gsi, RSHIFT_EXPR, type, op0, + return gimplify_build2 (gsi, code, type, op0, build_int_cst (NULL_TREE, shiftcnts[0])); } - op = optab_for_tree_code (RSHIFT_EXPR, type, optab_vector); + op = optab_for_tree_code (code, type, optab_vector); if (op != unknown_optab && can_implement_p (op, TYPE_MODE (type))) { tree_vector_builder vec (type, nunits, 1); for (i = 0; i < nunits; i++) vec.quick_push (build_int_cst (TREE_TYPE (type), shiftcnts[i])); - return gimplify_build2 (gsi, RSHIFT_EXPR, type, op0, vec.build ()); + return gimplify_build2 (gsi, code, type, op0, vec.build ()); } return NULL_TREE; } +/* Try to expand integer vector multiplication by constant of power 2 using + left shifts. */ +static tree +expand_vector_mult (gimple_stmt_iterator *gsi, tree type, tree op0, + tree op1) +{ + unsigned int nunits = nunits_for_known_piecewise_op (type); + int *shifts = XALLOCAVEC (int, nunits); + + // if all element are same value and a power of 2, then we can use shifts + for (unsigned int i = 0; i < nunits; i++) + { + tree cst = VECTOR_CST_ELT (op1, i); + if ((TREE_CODE (cst) != INTEGER_CST || integer_zerop (cst)) + || !integer_pow2p (cst) || tree_int_cst_sgn (cst) != 1) + return NULL_TREE; + shifts[i] = tree_log2 (cst); + } + tree cur_op = add_shift (gsi, type, op0, shifts, LSHIFT_EXPR); + return cur_op; +} /* Try to expand integer vector division by constant using widening multiply, shifts and additions. */ static tree @@ -705,14 +727,15 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0, { for (i = 0; i < nunits; i++) shift_temps[i] = prec - 1; - cur_op = add_rshift (gsi, type, op0, shift_temps); + cur_op = add_shift (gsi, type, op0, shift_temps, RSHIFT_EXPR); if (cur_op != NULL_TREE) { cur_op = gimplify_build1 (gsi, VIEW_CONVERT_EXPR, uns_type, cur_op); for (i = 0; i < nunits; i++) shift_temps[i] = prec - shifts[i]; - cur_op = add_rshift (gsi, uns_type, cur_op, shift_temps); + cur_op = add_shift (gsi, uns_type, cur_op, shift_temps, + RSHIFT_EXPR); if (cur_op != NULL_TREE) addend = gimplify_build1 (gsi, VIEW_CONVERT_EXPR, type, cur_op); @@ -748,7 +771,7 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0, if (sign_p == UNSIGNED) { /* q = op0 >> shift; */ - cur_op = add_rshift (gsi, type, op0, shifts); + cur_op = add_shift (gsi, type, op0, shifts, RSHIFT_EXPR); if (cur_op != NULL_TREE) return cur_op; } @@ -761,7 +784,7 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0, && can_implement_p (op, TYPE_MODE (type))) { cur_op = gimplify_build2 (gsi, PLUS_EXPR, type, op0, addend); - cur_op = add_rshift (gsi, type, cur_op, shifts); + cur_op = add_shift (gsi, type, cur_op, shifts, RSHIFT_EXPR); if (cur_op != NULL_TREE) return cur_op; } @@ -823,7 +846,7 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0, /* t1 = oprnd0 >> pre_shift; t2 = t1 h* ml; q = t2 >> post_shift; */ - cur_op = add_rshift (gsi, type, cur_op, pre_shifts); + cur_op = add_shift (gsi, type, cur_op, pre_shifts, RSHIFT_EXPR); if (cur_op == NULL_TREE) return NULL_TREE; break; @@ -860,7 +883,7 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0, /* t1 = oprnd0 >> pre_shift; t2 = t1 h* ml; q = t2 >> post_shift; */ - cur_op = add_rshift (gsi, type, cur_op, post_shifts); + cur_op = add_shift (gsi, type, cur_op, post_shifts, RSHIFT_EXPR); break; case 1: /* t1 = oprnd0 h* ml; @@ -873,13 +896,13 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0, || !can_implement_p (op, TYPE_MODE (type))) return NULL_TREE; tem = gimplify_build2 (gsi, MINUS_EXPR, type, op0, cur_op); - tem = add_rshift (gsi, type, tem, shift_temps); + tem = add_shift (gsi, type, tem, shift_temps, RSHIFT_EXPR); op = optab_for_tree_code (PLUS_EXPR, type, optab_default); if (op == unknown_optab || !can_implement_p (op, TYPE_MODE (type))) return NULL_TREE; tem = gimplify_build2 (gsi, PLUS_EXPR, type, cur_op, tem); - cur_op = add_rshift (gsi, type, tem, post_shifts); + cur_op = add_shift (gsi, type, tem, post_shifts, RSHIFT_EXPR); if (cur_op == NULL_TREE) return NULL_TREE; break; @@ -902,10 +925,10 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0, return NULL_TREE; cur_op = gimplify_build2 (gsi, PLUS_EXPR, type, cur_op, op0); } - cur_op = add_rshift (gsi, type, cur_op, post_shifts); + cur_op = add_shift (gsi, type, cur_op, post_shifts, RSHIFT_EXPR); if (cur_op == NULL_TREE) return NULL_TREE; - tem = add_rshift (gsi, type, op0, shift_temps); + tem = add_shift (gsi, type, op0, shift_temps, RSHIFT_EXPR); if (tem == NULL_TREE) return NULL_TREE; op = optab_for_tree_code (MINUS_EXPR, type, optab_default); @@ -1146,7 +1169,23 @@ expand_vector_operation (gimple_stmt_iterator *gsi, tree type, tree compute_type return ret; break; } + case MULT_EXPR: + { + tree rhs1 = gimple_assign_rhs1 (assign); + tree rhs2 = gimple_assign_rhs2 (assign); + tree ret; + + if (!optimize + || !VECTOR_INTEGER_TYPE_P (type) + || TREE_CODE (rhs2) != VECTOR_CST + || !VECTOR_MODE_P (TYPE_MODE (type))) + break; + ret = expand_vector_mult (gsi, type, rhs1, rhs2); + if (ret != NULL_TREE) + return ret; + break; + } default: break; } diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc index 20141dbc2e54..6af07efe68ac 100644 --- a/gcc/tree-vect-loop-manip.cc +++ b/gcc/tree-vect-loop-manip.cc @@ -2336,7 +2336,7 @@ vect_update_ivs_after_vectorizer (loop_vec_info loop_vinfo, gphi_iterator gsi, gsi1; class loop *loop = LOOP_VINFO_LOOP (loop_vinfo); basic_block update_bb = update_e->dest; - basic_block exit_bb = LOOP_VINFO_IV_EXIT (loop_vinfo)->dest; + basic_block exit_bb = update_e->src; gimple_stmt_iterator last_gsi = gsi_last_bb (exit_bb); for (gsi = gsi_start_phis (loop->header), gsi1 = gsi_start_phis (update_bb); diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc index e02b3379bb46..aa6c3e2e041d 100644 --- a/gcc/tree-vect-slp.cc +++ b/gcc/tree-vect-slp.cc @@ -558,7 +558,8 @@ vect_get_operand_map (const gimple *stmt, bool gather_scatter_p = false, if (gimple_assign_rhs_code (assign) == COND_EXPR && COMPARISON_CLASS_P (gimple_assign_rhs1 (assign))) gcc_unreachable (); - if (TREE_CODE_CLASS (gimple_assign_rhs_code (assign)) == tcc_comparison + if ((TREE_CODE_CLASS (gimple_assign_rhs_code (assign)) == tcc_comparison + || commutative_tree_code (gimple_assign_rhs_code (assign))) && swap) return op1_op0_map; if (gather_scatter_p) @@ -1352,7 +1353,12 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap, uniform but only that of the first stmt matters. */ && !(first_reduc_idx != -1 && STMT_VINFO_REDUC_IDX (stmt_info) != -1 - && REDUC_GROUP_FIRST_ELEMENT (stmt_info))) + && REDUC_GROUP_FIRST_ELEMENT (stmt_info)) + && !(first_reduc_idx != -1 + && STMT_VINFO_REDUC_IDX (stmt_info) != -1 + && rhs_code.is_tree_code () + && commutative_tree_code (tree_code (rhs_code)) + && first_reduc_idx == 1 - STMT_VINFO_REDUC_IDX (stmt_info))) { if (dump_enabled_p ()) { @@ -1617,6 +1623,15 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap, && (swap_tree_comparison ((tree_code)first_stmt_code) == (tree_code)rhs_code)) swap[i] = 1; + + if (i != 0 + && first_reduc_idx != STMT_VINFO_REDUC_IDX (stmt_info) + && first_reduc_idx != -1 + && STMT_VINFO_REDUC_IDX (stmt_info) != -1 + && rhs_code.is_tree_code () + && commutative_tree_code (tree_code (rhs_code)) + && first_reduc_idx == 1 - STMT_VINFO_REDUC_IDX (stmt_info)) + swap[i] = 1; } matches[i] = true; @@ -4045,7 +4060,9 @@ vect_build_slp_store_interleaving (vec &rhs_nodes, } /* Analyze an SLP instance starting from SCALAR_STMTS which are a group - of KIND. Return true if successful. */ + of KIND. Return true if successful. SCALAR_STMTS is owned by this + function, REMAIN and ROOT_STMT_INFOS ownership is transfered back to + the caller upon failure. */ static bool vect_build_slp_instance (vec_info *vinfo, @@ -4059,7 +4076,10 @@ vect_build_slp_instance (vec_info *vinfo, { /* If there's no budget left bail out early. */ if (*limit == 0) - return false; + { + scalar_stmts.release (); + return false; + } if (kind == slp_inst_kind_ctor) { @@ -4159,6 +4179,10 @@ vect_build_slp_instance (vec_info *vinfo, if (dump_enabled_p ()) { + if (kind == slp_inst_kind_reduc_group) + dump_printf_loc (MSG_NOTE, vect_location, + "SLP discovery of size %d reduction group " + "succeeded\n", group_size); dump_printf_loc (MSG_NOTE, vect_location, "Final SLP tree for instance %p:\n", (void *) new_instance); @@ -5564,10 +5588,10 @@ vect_analyze_slp (vec_info *vinfo, unsigned max_tree_size, bb_vinfo->roots[i].remain, max_tree_size, &limit, bst_map, false)) { - bb_vinfo->roots[i].stmts = vNULL; bb_vinfo->roots[i].roots = vNULL; bb_vinfo->roots[i].remain = vNULL; } + bb_vinfo->roots[i].stmts = vNULL; } } @@ -6297,6 +6321,7 @@ class vect_optimize_slp_pass /* Layout selection. */ bool is_compatible_layout (slp_tree, unsigned int); + bool is_compatible_layout (const slpg_partition_info &, unsigned int); int change_layout_cost (slp_tree, unsigned int, unsigned int); slpg_partition_layout_costs &partition_layout_costs (unsigned int, unsigned int); @@ -6304,6 +6329,7 @@ class vect_optimize_slp_pass int, unsigned int); int internal_node_cost (slp_tree, int, unsigned int); void start_choosing_layouts (); + bool legitimize (); /* Cost propagation. */ slpg_layout_cost edge_layout_cost (graph_edge *, unsigned int, @@ -6710,6 +6736,29 @@ vect_optimize_slp_pass::is_compatible_layout (slp_tree node, return true; } +/* Return true if layout LAYOUT_I is compatible with the number of SLP lanes + that NODE would operate on for each NODE in PARTITION. + This test is independent of NODE's actual operations. */ + +bool +vect_optimize_slp_pass::is_compatible_layout (const slpg_partition_info + &partition, + unsigned int layout_i) +{ + for (unsigned int order_i = partition.node_begin; + order_i < partition.node_end; ++order_i) + { + unsigned int node_i = m_partitioned_nodes[order_i]; + auto &vertex = m_vertices[node_i]; + + /* The layout is incompatible if it is individually incompatible + with any node in the partition. */ + if (!is_compatible_layout (vertex.node, layout_i)) + return false; + } + return true; +} + /* Return the cost (in arbtirary units) of going from layout FROM_LAYOUT_I to layout TO_LAYOUT_I for a node like NODE. Return -1 if either of the layouts is incompatible with NODE or if the change is not possible for @@ -8029,6 +8078,62 @@ vect_optimize_slp_pass::decide_masked_load_lanes () } } +/* Perform legitimizing attempts. This is intended to improve the + situation when layout 0 is not valid which is a situation the cost + based propagation does not handle well. + Return true if further layout optimization is possible, false if + the layout configuration should be considered final. */ + +bool +vect_optimize_slp_pass::legitimize () +{ + /* Perform a very simple legitimizing attempt by attempting to choose + a single layout for all partitions that will make all permutations + a noop. That should also be the optimal layout choice in case + layout zero is legitimate. + ??? Disconnected components of the SLP graph could have distinct + single layouts. */ + int single_layout_i = -1; + unsigned deferred_up_to = -1U; + for (unsigned partition_i = 0; partition_i < m_partitions.length (); + ++partition_i) + { + auto &partition = m_partitions[partition_i]; + if (single_layout_i == -1) + { + single_layout_i = partition.layout; + deferred_up_to = partition_i; + } + else if (partition.layout == single_layout_i || partition.layout == -1) + ; + else + single_layout_i = 0; + if (single_layout_i == 0) + return true; + + if (single_layout_i != -1 + && !is_compatible_layout (partition, single_layout_i)) + return true; + } + + if (single_layout_i <= 0) + return true; + + for (unsigned partition_i = 0; partition_i < deferred_up_to; ++partition_i) + if (!is_compatible_layout (m_partitions[partition_i], + single_layout_i)) + return true; + + for (unsigned partition_i = 0; partition_i < m_partitions.length (); + ++partition_i) + { + auto &partition = m_partitions[partition_i]; + partition.layout = single_layout_i; + } + + return false; +} + /* Main entry point for the SLP graph optimization pass. */ void @@ -8039,8 +8144,11 @@ vect_optimize_slp_pass::run () start_choosing_layouts (); if (m_perms.length () > 1) { - forward_pass (); - backward_pass (); + if (legitimize ()) + { + forward_pass (); + backward_pass (); + } if (dump_enabled_p ()) dump (); materialize (); @@ -9031,8 +9139,11 @@ vect_slp_analyze_operations (vec_info *vinfo) stmt_vec_info stmt_info; if (!SLP_INSTANCE_ROOT_STMTS (instance).is_empty ()) stmt_info = SLP_INSTANCE_ROOT_STMTS (instance)[0]; - else + else if (!SLP_TREE_SCALAR_STMTS (node).is_empty () + && SLP_TREE_SCALAR_STMTS (node)[0]) stmt_info = SLP_TREE_SCALAR_STMTS (node)[0]; + else + stmt_info = SLP_TREE_REPRESENTATIVE (node); if (is_a (vinfo)) { if (dump_enabled_p ()) diff --git a/gcc/varpool.cc b/gcc/varpool.cc index 976e0fa60aa0..8dc5f9862945 100644 --- a/gcc/varpool.cc +++ b/gcc/varpool.cc @@ -172,11 +172,7 @@ void varpool_node::remove (void) { symtab->call_varpool_removal_hooks (this); - if (lto_file_data) - { - lto_free_function_in_decl_state_for_node (this); - lto_file_data = NULL; - } + lto_free_function_in_decl_state_for_node (this); /* When streaming we can have multiple nodes associated with decl. */ if (symtab->state == LTO_STREAMING) diff --git a/libgcobol/ChangeLog b/libgcobol/ChangeLog index 67b25fe4955f..315e1cc6b246 100644 --- a/libgcobol/ChangeLog +++ b/libgcobol/ChangeLog @@ -1,3 +1,55 @@ +2025-10-28 Sam James + + PR cobol/122451 + * xmlparse.cc (context_t): Make 'ctxt' public. + (xml_push_parse): Fix xmlCtxtGetVersion argument. + +2025-10-27 Sam James + + PR cobol/122451 + * xmlparse.cc (xml_push_parse): Fix xmlCtxtGetVersion argument + typo to be 'context'. + +2025-10-27 James K. Lowden + + * xmlparse.cc (CTX): Macro for unused user-context parameter. + (attributeDecl): Mark unused parameters. + (cdataBlock): Same. + (characters): Same. + (comment): Same. + (elementDecl): Same. + (endDocument): Same. + (endElementNs): Same. + (endElement): Same. + (entityDecl): Same. + (error): Same. + (externalSubset): Same. + (fatalError): Same. + (getEntity): Eliminate via preprocessor until needed. + (getParameterEntity): Same. + (hasExternalSubset): Mark unused parameters. + (hasInternalSubset): Same. + (ignorableWhitespace): Same. + (internalSubset): Same. + (isStandalone): Eliminate via preprocessor until needed. + (notationDecl): Mark unused parameters. + (processingInstruction): Same. + (reference): Same. + (resolveEntity): Eliminate via preprocessor until needed. + (setDocumentLocator): Mark unused parameters. + (startDocument): Same. + (startElementNs): Same. + (startElement): Same. + (unparsedEntityDecl): Same. + (warning): Same. + (xmlchar_of): Utility cast function. + (xmlParserErrors_str): Message string for libxml2 errors. + (xmlerror_str): Macro to include textual form of libxml2 error. + (context_t): Push-parser context class. + (xml_push_parse): Use push-parser. + (__gg__xml_parse_done): Signify end-of-input to XML push-parser. + (__gg__xml_parse): Mark unused parameters. + 2025-10-25 Sam James PR cobol/122398 diff --git a/libgcobol/xmlparse.cc b/libgcobol/xmlparse.cc index edaf12415c22..54b9f02ca37c 100644 --- a/libgcobol/xmlparse.cc +++ b/libgcobol/xmlparse.cc @@ -658,9 +658,9 @@ xmlParserErrors_str( xmlParserErrors erc, const char name[] ) { * The global context is NULL if XML PARSE is not in progress. */ static class context_t { - xmlParserCtxt * ctxt; const int priority; public: + xmlParserCtxt * ctxt; context_t() : ctxt(nullptr), priority(LOG_INFO) { const int option = LOG_PERROR, facility = LOG_USER; #if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME @@ -734,7 +734,7 @@ xml_push_parse( cblc_field_t *input_field, context.push( input_field, input_offset, len, false); #if LIBXML_VERSION >= 21400 - const xmlChar * version = xmlCtxtGetVersion( ctxt ); + const xmlChar * version = xmlCtxtGetVersion( context.ctxt ); #else const xmlChar * version = xmlchar_of("requires version 2.14"); #endif diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index ab7f75232a32..50667924d5cf 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,7 @@ +2025-10-28 Thomas Schwinge + + * env.c (initialize_env): Simplify 'parse_stacksize' call. + 2025-10-23 Andrew Stubbs * Makefile.am (libgomp_la_SOURCES): Add simple-allocator.c. diff --git a/libgomp/env.c b/libgomp/env.c index 626a753ca71b..f63a36afdd23 100644 --- a/libgomp/env.c +++ b/libgomp/env.c @@ -2455,7 +2455,7 @@ initialize_env (void) const char *env = getenv ("GOMP_STACKSIZE"); if (env != NULL && parse_stacksize ("GOMP_STACKSIZE", env, - (void *[3]) {&none->icvs.stacksize})) + (void *[]) {&none->icvs.stacksize})) gomp_set_icv_flag (&none->flags, GOMP_ICV_STACKSIZE); } if (none != NULL && gomp_get_icv_flag (none->flags, GOMP_ICV_STACKSIZE)) diff --git a/libgrust/ChangeLog b/libgrust/ChangeLog index dfb93f0dfa24..a4cab10041bf 100644 --- a/libgrust/ChangeLog +++ b/libgrust/ChangeLog @@ -1,3 +1,261 @@ +2025-10-30 Owen Avery + + * libformat_parser/src/lib.rs (struct FFIOpt): Likewise and + remove some now-redundant methods. + +2025-10-30 Owen Avery + + * rustc-lib/stdarch/.cirrus.yml: New file. + * rustc-lib/stdarch/.github/workflows/main.yml: New file. + * rustc-lib/stdarch/.gitignore: New file. + * rustc-lib/stdarch/CONTRIBUTING.md: New file. + * rustc-lib/stdarch/Cargo.toml: New file. + * rustc-lib/stdarch/LICENSE-APACHE: New file. + * rustc-lib/stdarch/LICENSE-MIT: New file. + * rustc-lib/stdarch/README.md: New file. + * rustc-lib/stdarch/ci/android-install-ndk.sh: New file. + * rustc-lib/stdarch/ci/android-install-sdk.sh: New file. + * rustc-lib/stdarch/ci/android-sysimage.sh: New file. + * rustc-lib/stdarch/ci/docker/aarch64-linux-android/Dockerfile: New file. + * rustc-lib/stdarch/ci/docker/aarch64-unknown-linux-gnu/Dockerfile: New file. + * rustc-lib/stdarch/ci/docker/arm-linux-androideabi/Dockerfile: New file. + * rustc-lib/stdarch/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile: New file. + * rustc-lib/stdarch/ci/docker/armv7-unknown-linux-gnueabihf/Dockerfile: New file. + * rustc-lib/stdarch/ci/docker/i586-unknown-linux-gnu/Dockerfile: New file. + * rustc-lib/stdarch/ci/docker/i686-unknown-linux-gnu/Dockerfile: New file. + * rustc-lib/stdarch/ci/docker/mips-unknown-linux-gnu/Dockerfile: New file. + * rustc-lib/stdarch/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile: New file. + * rustc-lib/stdarch/ci/docker/mips64el-unknown-linux-gnuabi64/Dockerfile: New file. + * rustc-lib/stdarch/ci/docker/mipsel-unknown-linux-musl/Dockerfile: New file. + * rustc-lib/stdarch/ci/docker/nvptx64-nvidia-cuda/Dockerfile: New file. + * rustc-lib/stdarch/ci/docker/powerpc-unknown-linux-gnu/Dockerfile: New file. + * rustc-lib/stdarch/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile: New file. + * rustc-lib/stdarch/ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile: New file. + * rustc-lib/stdarch/ci/docker/s390x-unknown-linux-gnu/Dockerfile: New file. + * rustc-lib/stdarch/ci/docker/wasm32-wasi/Dockerfile: New file. + * rustc-lib/stdarch/ci/docker/x86_64-linux-android/Dockerfile: New file. + * rustc-lib/stdarch/ci/docker/x86_64-unknown-linux-gnu-emulated/Dockerfile: New file. + * rustc-lib/stdarch/ci/docker/x86_64-unknown-linux-gnu/Dockerfile: New file. + * rustc-lib/stdarch/ci/dox.sh: New file. + * rustc-lib/stdarch/ci/gba.json: New file. + * rustc-lib/stdarch/ci/run-docker.sh: New file. + * rustc-lib/stdarch/ci/run.sh: New file. + * rustc-lib/stdarch/ci/runtest-android.rs: New file. + * rustc-lib/stdarch/ci/style.sh: New file. + * rustc-lib/stdarch/crates/assert-instr-macro/Cargo.toml: New file. + * rustc-lib/stdarch/crates/assert-instr-macro/build.rs: New file. + * rustc-lib/stdarch/crates/assert-instr-macro/src/lib.rs: New file. + * rustc-lib/stdarch/crates/core_arch/Cargo.toml: New file. + * rustc-lib/stdarch/crates/core_arch/LICENSE-APACHE: New file. + * rustc-lib/stdarch/crates/core_arch/LICENSE-MIT: New file. + * rustc-lib/stdarch/crates/core_arch/README.md: New file. + * rustc-lib/stdarch/crates/core_arch/avx512f.md: New file. + * rustc-lib/stdarch/crates/core_arch/build.rs: New file. + * rustc-lib/stdarch/crates/core_arch/rustfmt.toml: New file. + * rustc-lib/stdarch/crates/core_arch/src/aarch64/crc.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/aarch64/crypto.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/aarch64/mod.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/aarch64/neon/generated.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/aarch64/neon/mod.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/aarch64/prefetch.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/aarch64/test_support.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/aarch64/tme.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/aarch64/v8.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/acle/barrier/common.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/acle/barrier/cp15.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/acle/barrier/mod.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/acle/barrier/not_mclass.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/acle/barrier/v8.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/acle/dsp.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/acle/ex.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/acle/hints.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/acle/mod.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/acle/registers/aarch32.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/acle/registers/mod.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/acle/registers/v6m.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/acle/registers/v7m.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/acle/sat.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/acle/simd32.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/arm/armclang.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/arm/crc.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/arm/mod.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/arm/neon/generated.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/arm/neon/mod.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/arm/neon/table_lookup_tests.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/arm/test_support.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/arm/v6.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/arm/v7.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/core_arch_docs.md: New file. + * rustc-lib/stdarch/crates/core_arch/src/lib.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/macros.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/mips/mod.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/mips/msa.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/mips/msa/macros.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/mod.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/nvptx/mod.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/powerpc/altivec.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/powerpc/mod.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/powerpc/vsx.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/powerpc64/mod.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/simd.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/simd_llvm.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/v64.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/wasm32/atomic.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/wasm32/memory.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/wasm32/mod.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/wasm32/simd128.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86/abm.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86/adx.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86/aes.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86/avx.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86/avx2.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86/avx512f.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86/avx512ifma.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86/bmi1.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86/bmi2.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86/bswap.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86/bt.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86/cpuid.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86/eflags.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86/f16c.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86/fma.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86/fxsr.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86/macros.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86/mod.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86/pclmulqdq.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86/rdrand.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86/rdtsc.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86/rtm.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86/sha.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86/sse.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86/sse2.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86/sse3.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86/sse41.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86/sse42.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86/sse4a.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86/ssse3.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86/tbm.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86/test.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86/xsave.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86_64/abm.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86_64/adx.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86_64/avx.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86_64/avx2.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86_64/avx512f.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86_64/bmi.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86_64/bmi2.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86_64/bswap.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86_64/bt.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86_64/cmpxchg16b.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86_64/fxsr.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86_64/mod.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86_64/rdrand.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86_64/sse.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86_64/sse2.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86_64/sse41.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86_64/sse42.rs: New file. + * rustc-lib/stdarch/crates/core_arch/src/x86_64/xsave.rs: New file. + * rustc-lib/stdarch/crates/core_arch/tests/cpu-detection.rs: New file. + * rustc-lib/stdarch/crates/simd-test-macro/Cargo.toml: New file. + * rustc-lib/stdarch/crates/simd-test-macro/src/lib.rs: New file. + * rustc-lib/stdarch/crates/std_detect/Cargo.toml: New file. + * rustc-lib/stdarch/crates/std_detect/LICENSE-APACHE: New file. + * rustc-lib/stdarch/crates/std_detect/LICENSE-MIT: New file. + * rustc-lib/stdarch/crates/std_detect/README.md: New file. + * rustc-lib/stdarch/crates/std_detect/src/detect/arch/aarch64.rs: New file. + * rustc-lib/stdarch/crates/std_detect/src/detect/arch/arm.rs: New file. + * rustc-lib/stdarch/crates/std_detect/src/detect/arch/mips.rs: New file. + * rustc-lib/stdarch/crates/std_detect/src/detect/arch/mips64.rs: New file. + * rustc-lib/stdarch/crates/std_detect/src/detect/arch/powerpc.rs: New file. + * rustc-lib/stdarch/crates/std_detect/src/detect/arch/powerpc64.rs: New file. + * rustc-lib/stdarch/crates/std_detect/src/detect/arch/x86.rs: New file. + * rustc-lib/stdarch/crates/std_detect/src/detect/bit.rs: New file. + * rustc-lib/stdarch/crates/std_detect/src/detect/cache.rs: New file. + * rustc-lib/stdarch/crates/std_detect/src/detect/error_macros.rs: New file. + * rustc-lib/stdarch/crates/std_detect/src/detect/macros.rs: New file. + * rustc-lib/stdarch/crates/std_detect/src/detect/mod.rs: New file. + * rustc-lib/stdarch/crates/std_detect/src/detect/os/aarch64.rs: New file. + * rustc-lib/stdarch/crates/std_detect/src/detect/os/freebsd/aarch64.rs: New file. + * rustc-lib/stdarch/crates/std_detect/src/detect/os/freebsd/arm.rs: New file. + * rustc-lib/stdarch/crates/std_detect/src/detect/os/freebsd/auxvec.rs: New file. + * rustc-lib/stdarch/crates/std_detect/src/detect/os/freebsd/mod.rs: New file. + * rustc-lib/stdarch/crates/std_detect/src/detect/os/freebsd/powerpc.rs: New file. + * rustc-lib/stdarch/crates/std_detect/src/detect/os/linux/aarch64.rs: New file. + * rustc-lib/stdarch/crates/std_detect/src/detect/os/linux/arm.rs: New file. + * rustc-lib/stdarch/crates/std_detect/src/detect/os/linux/auxvec.rs: New file. + * rustc-lib/stdarch/crates/std_detect/src/detect/os/linux/cpuinfo.rs: New file. + * rustc-lib/stdarch/crates/std_detect/src/detect/os/linux/mips.rs: New file. + * rustc-lib/stdarch/crates/std_detect/src/detect/os/linux/mod.rs: New file. + * rustc-lib/stdarch/crates/std_detect/src/detect/os/linux/powerpc.rs: New file. + * rustc-lib/stdarch/crates/std_detect/src/detect/os/other.rs: New file. + * rustc-lib/stdarch/crates/std_detect/src/detect/os/windows/aarch64.rs: New file. + * rustc-lib/stdarch/crates/std_detect/src/detect/os/x86.rs: New file. + * rustc-lib/stdarch/crates/std_detect/src/detect/test_data/linux-rpi3.auxv: New file. + * rustc-lib/stdarch/crates/std_detect/src/detect/test_data/linux-x64-i7-6850k.auxv: + New file. + * rustc-lib/stdarch/crates/std_detect/src/detect/test_data/macos-virtualbox-linux-x86-4850HQ.auxv: + New file. + * rustc-lib/stdarch/crates/std_detect/src/lib.rs: New file. + * rustc-lib/stdarch/crates/std_detect/src/mod.rs: New file. + * rustc-lib/stdarch/crates/std_detect/tests/cpu-detection.rs: New file. + * rustc-lib/stdarch/crates/std_detect/tests/macro_trailing_commas.rs: New file. + * rustc-lib/stdarch/crates/std_detect/tests/x86-specific.rs: New file. + * rustc-lib/stdarch/crates/stdarch-gen/Cargo.toml: New file. + * rustc-lib/stdarch/crates/stdarch-gen/README.md: New file. + * rustc-lib/stdarch/crates/stdarch-gen/neon.spec: New file. + * rustc-lib/stdarch/crates/stdarch-gen/src/main.rs: New file. + * rustc-lib/stdarch/crates/stdarch-test/Cargo.toml: New file. + * rustc-lib/stdarch/crates/stdarch-test/src/disassembly.rs: New file. + * rustc-lib/stdarch/crates/stdarch-test/src/lib.rs: New file. + * rustc-lib/stdarch/crates/stdarch-test/src/wasm.rs: New file. + * rustc-lib/stdarch/crates/stdarch-verify/.gitattributes: New file. + * rustc-lib/stdarch/crates/stdarch-verify/Cargo.toml: New file. + * rustc-lib/stdarch/crates/stdarch-verify/arm-intrinsics.html: New file. + * rustc-lib/stdarch/crates/stdarch-verify/build.rs: New file. + * rustc-lib/stdarch/crates/stdarch-verify/mips-msa.h: New file. + * rustc-lib/stdarch/crates/stdarch-verify/src/lib.rs: New file. + * rustc-lib/stdarch/crates/stdarch-verify/tests/arm.rs: New file. + * rustc-lib/stdarch/crates/stdarch-verify/tests/mips.rs: New file. + * rustc-lib/stdarch/crates/stdarch-verify/tests/x86-intel.rs: New file. + * rustc-lib/stdarch/crates/stdarch-verify/x86-intel.xml: New file. + * rustc-lib/stdarch/examples/Cargo.toml: New file. + * rustc-lib/stdarch/examples/hex.rs: New file. + * rustc-lib/stdarch/examples/wasm.rs: New file. + * rustc-lib/stdarch/triagebot.toml: New file. + * rustc-lib/stdarch/vendor.yml: New file. + +2025-10-30 Owen Avery + + * rustc-lib/LICENSE-APACHE: New file. + * rustc-lib/LICENSE-MIT: New file. + * rustc-lib/version-info: New file. + +2025-10-30 Owen Avery + + * libformat_parser/src/lib.rs (struct FFIVec): New. + (trait StringLeakExt): Remove. + (struct FFIOpt): New. + (trait IntoFFI): Adjust implementation for Option. + (struct RustHamster): Add lifetime and adjust conversion to and + from &str. + (enum Piece): Adjust definition to handle changes to + RustHamster. + (struct Argument): Likewise. + (struct FormatSpec): Use FFIOpt and RustHamster. + (enum Position): Use RustHamster. + (enum Count): Likewise. + (struct PieceSlice): Replace with... + (typedef PieceVec): ...this. + (struct RustString): Remove. + (struct FormatArgsHandle): Likewise. + (fn collect_pieces): Adjust signature, greatly simplifying + implementation. + (fn clone_pieces): Likewise. + (fn destroy_pieces): Remove. + (trait LayoutExt): New. + (fn rust_ffi_alloc): New. + (fn rust_ffi_dealloc): New. + 2025-10-05 Sam James * Makefile.in: Regenerate. diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 04bba2cc4cfb..e270c676a7a6 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,99 @@ +2025-10-30 Jakub Jelinek + + * include/bits/version.def (is_implicit_lifetime): New. + * include/bits/version.h: Regenerate. + * include/std/type_traits (std::is_implicit_lifetime, + std::is_implicit_lifetime_v): New trait. + * src/c++23/std.cc.in (std::is_implicit_lifetime, + std::is_implicit_lifetime_v): Export. + * testsuite/20_util/is_implicit_lifetime/version.cc: New test. + * testsuite/20_util/is_implicit_lifetime/value.cc: New test. + +2025-10-29 Jonathan Wakely + + * include/bits/regex.tcc (regex_traits::value): Use __c instead + of __ch. + +2025-10-29 Jonathan Wakely + + * testsuite/17_intro/headers/c++2011/42319.cc: Include + instead of . Add no_pch option. Remove + explicit -std=gnu++11 option. + * testsuite/30_threads/thread/swap/1.cc: Include + instead of . + +2025-10-29 Tomasz Kamiński + + PR libstdc++/119721 + * include/std/tuple (tuple<>::operator=(const _Tuple&) const) + [__cpp_lib_ranges_zip]: Define. + * testsuite/23_containers/tuple/cons/119721.cc: Test const + assignment. + +2025-10-29 Osama Abdelkader + Tomasz Kamiński + + PR libstdc++/119721 + * include/std/tuple (tuple<>::tuple(const tuple&)) + (tuple<>::operator=(const tuple&)): Define as defaulted. + (tuple<>::swap): Moved the defintion after assignments. + (tuple<>::tuple(_UTuple&&)) + (tuple<>::tuple(allocator_arg_t, const _Alloc&, _UTuple&&)) + (tuple<>::operator=(_UTuple&&)) [__cpp_lib_tuple_like]: Define. + (tuple<>::operator==, tuple<>::opeator<=>): Parenthesize + constrains individually. + * testsuite/23_containers/tuple/cons/119721.cc: New test for + constructors and assignments with empty tuple-like types. + * testsuite/20_util/tuple/requirements/empty_trivial.cc: + New test verifying tuple<> remains trivially copyable. + +2025-10-29 Jonathan Wakely + + * include/bits/regex.tcc (regex_traits::value): Implement + without using istringstream. + * include/std/regex: Do not include . + +2025-10-28 Jonathan Wakely + + PR libstdc++/122401 + * testsuite/30_threads/shared_timed_mutex/try_lock_until/116586.cc: + Do not try to acquire locks on the thread that already holds a + lock. Add -pthread for et pthread. + +2025-10-27 Jonathan Wakely + + PR libstdc++/122401 + * testsuite/20_util/shared_ptr/atomic/pr118757.cc: Add -pthread + for et pthread. + * testsuite/20_util/weak_ptr/pr118757.cc: Likewise. + * testsuite/30_threads/condition_variable/members/116586.cc: + Likewise. Only run for hosted targets with gthreads support. + * testsuite/30_threads/future/members/116586.cc: Likewise. + * testsuite/30_threads/recursive_timed_mutex/try_lock_until/116586.cc: + Likewise. + * testsuite/30_threads/timed_mutex/try_lock_until/116586.cc: + Likewise. + +2025-10-27 Matthias Kretz + + * include/bits/utility.h (_IotaArray): Define. + * testsuite/ext/iotaarray.cc: New test. + +2025-10-27 Jonathan Wakely + + PR libstdc++/108951 + * include/bits/valarray_array.h( __valarray_get_storage): Use + std::__new_allocator. + (__valarray_release_memory): Likewise. + * include/std/valarray: Pass _M_size to + __valarray_release_memory. + * testsuite/26_numerics/valarray/108951.cc: New test. + +2025-10-27 Jonathan Wakely + + * testsuite/util/testsuite_iterators.h (test_container): Add + iterator and value_type typedefs. + 2025-10-24 Eric Pimentel Aguiar * src/c++23/std.cc.in (std::strided_slice, std::full_extent_t) diff --git a/libstdc++-v3/include/bits/regex.tcc b/libstdc++-v3/include/bits/regex.tcc index b94fe4490f7c..48917cdfda91 100644 --- a/libstdc++-v3/include/bits/regex.tcc +++ b/libstdc++-v3/include/bits/regex.tcc @@ -331,20 +331,53 @@ namespace __detail && __c == __fctyp.widen('_')); } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++17-extensions" // if constexpr template int regex_traits<_Ch_type>:: value(_Ch_type __ch, int __radix) const { - std::basic_istringstream __is(string_type(1, __ch)); - long __v; - if (__radix == 8) - __is >> std::oct; - else if (__radix == 16) - __is >> std::hex; - __is >> __v; - return __is.fail() ? -1 : __v; + if constexpr (sizeof(_Ch_type) > 1) + { + const auto& __ctyp = std::use_facet>(_M_locale); + const char __c = __ctyp.narrow(__ch, '\0'); + return regex_traits{}.value(__c, __radix); + } + else + { + const char __c = static_cast(__ch); + const char __max_digit = __radix == 8 ? '7' : '9'; + if ('0' <= __c && __c <= __max_digit) + return __c - '0'; + if (__radix < 16) + return -1; + switch (__c) + { + case 'a': + case 'A': + return 10; + case 'b': + case 'B': + return 11; + case 'c': + case 'C': + return 12; + case 'd': + case 'D': + return 13; + case 'e': + case 'E': + return 14; + case 'f': + case 'F': + return 15; + default: + return -1; + } + } } +#pragma GCC diagnostic pop template template diff --git a/libstdc++-v3/include/bits/version.def b/libstdc++-v3/include/bits/version.def index 1bf98f74d459..29ecf15c7e39 100644 --- a/libstdc++-v3/include/bits/version.def +++ b/libstdc++-v3/include/bits/version.def @@ -2191,6 +2191,15 @@ ftms = { }; }; +ftms = { + name = is_implicit_lifetime; + values = { + v = 202302; + cxxmin = 23; + extra_cond = "__has_builtin(__builtin_is_implicit_lifetime)"; + }; +}; + // Standard test specifications. stds[97] = ">= 199711L"; stds[03] = ">= 199711L"; diff --git a/libstdc++-v3/include/bits/version.h b/libstdc++-v3/include/bits/version.h index 66de8b487e35..5901d27113d7 100644 --- a/libstdc++-v3/include/bits/version.h +++ b/libstdc++-v3/include/bits/version.h @@ -2455,4 +2455,14 @@ #endif /* !defined(__cpp_lib_philox_engine) */ #undef __glibcxx_want_philox_engine +#if !defined(__cpp_lib_is_implicit_lifetime) +# if (__cplusplus >= 202100L) && (__has_builtin(__builtin_is_implicit_lifetime)) +# define __glibcxx_is_implicit_lifetime 202302L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_is_implicit_lifetime) +# define __cpp_lib_is_implicit_lifetime 202302L +# endif +# endif +#endif /* !defined(__cpp_lib_is_implicit_lifetime) */ +#undef __glibcxx_want_is_implicit_lifetime + #undef __glibcxx_want_all diff --git a/libstdc++-v3/include/std/regex b/libstdc++-v3/include/std/regex index 022306621cba..9121d267a793 100644 --- a/libstdc++-v3/include/std/regex +++ b/libstdc++-v3/include/std/regex @@ -41,7 +41,6 @@ #include #include -#include #include #include #include diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple index c064a92df4c1..d4db12557ab6 100644 --- a/libstdc++-v3/include/std/tuple +++ b/libstdc++-v3/include/std/tuple @@ -1984,14 +1984,27 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class tuple<> { public: + // We need the default since we're going to define no-op + // allocator constructors. + tuple() = default; + // Defaulted copy operations to maintain trivial copyability. + // and support non-const assignment expressions. + tuple(const tuple&) = default; + tuple& operator=(const tuple&) = default; + _GLIBCXX20_CONSTEXPR void swap(tuple&) noexcept { /* no-op */ } + #if __cpp_lib_ranges_zip // >= C++23 - constexpr void swap(const tuple&) const noexcept { /* no-op */ } + template _Tuple = tuple> + constexpr const tuple& + operator=(const _Tuple&) const noexcept + { return *this; } + + constexpr void swap(const tuple&) const noexcept + { /* no-op */ } #endif - // We need the default since we're going to define no-op - // allocator constructors. - tuple() = default; + // No-op allocator constructors. template _GLIBCXX20_CONSTEXPR @@ -2001,16 +2014,42 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION tuple(allocator_arg_t, const _Alloc&, const tuple&) noexcept { } #if __cpp_lib_tuple_like // >= C++23 - // Comparison operators for tuple<> with other empty tuple-like types template<__tuple_like _UTuple> - requires (!__is_tuple_v<_UTuple> && tuple_size_v<_UTuple> == 0) + requires (!is_same_v, tuple>) + && (!is_same_v, allocator_arg_t>) + && (tuple_size_v> == 0) + constexpr + tuple(_UTuple&&) noexcept { } + + template + requires (!is_same_v, tuple>) + && (tuple_size_v> == 0) + constexpr + tuple(allocator_arg_t, const _Alloc&, _UTuple&&) noexcept { } + + template<__tuple_like _UTuple> + requires (!is_same_v, tuple>) + && (tuple_size_v> == 0) + constexpr tuple& + operator=(_UTuple&&) noexcept + { return *this; } + + template<__tuple_like _UTuple> + requires (!is_same_v, tuple>) + && (tuple_size_v> == 0) + constexpr const tuple& + operator=(_UTuple&&) const noexcept + { return *this; } + + template<__tuple_like _UTuple> + requires (!__is_tuple_v<_UTuple>) && (tuple_size_v<_UTuple> == 0) [[nodiscard]] friend constexpr bool operator==(const tuple&, const _UTuple&) noexcept { return true; } template<__tuple_like _UTuple> - requires (!__is_tuple_v<_UTuple> && tuple_size_v<_UTuple> == 0) + requires (!__is_tuple_v<_UTuple>) && (tuple_size_v<_UTuple> == 0) friend constexpr strong_ordering operator<=>(const tuple&, const _UTuple&) noexcept { return strong_ordering::equal; } diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 77ebb7e2c2f9..d28b077398be 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -47,6 +47,7 @@ #define __glibcxx_want_is_aggregate #define __glibcxx_want_is_constant_evaluated #define __glibcxx_want_is_final +#define __glibcxx_want_is_implicit_lifetime #define __glibcxx_want_is_invocable #define __glibcxx_want_is_layout_compatible #define __glibcxx_want_is_nothrow_convertible @@ -4053,6 +4054,22 @@ template # endif #endif +#ifdef __cpp_lib_is_implicit_lifetime // C++ >= 23 + /// True if the type is an implicit-lifetime type. + /// @since C++23 + + template + struct is_implicit_lifetime + : bool_constant<__builtin_is_implicit_lifetime(_Tp)> + { }; + + /// @ingroup variable_templates + /// @since C++23 + template + inline constexpr bool is_implicit_lifetime_v + = __builtin_is_implicit_lifetime(_Tp); +#endif + #ifdef __cpp_lib_reference_from_temporary // C++ >= 23 && ref_{converts,constructs}_from_temp /// True if _Tp is a reference type, a _Up value can be bound to _Tp in /// direct-initialization, and a temporary object would be bound to diff --git a/libstdc++-v3/src/c++23/std.cc.in b/libstdc++-v3/src/c++23/std.cc.in index 4c11b1bf7114..28f0e8cb1fb6 100644 --- a/libstdc++-v3/src/c++23/std.cc.in +++ b/libstdc++-v3/src/c++23/std.cc.in @@ -3230,6 +3230,10 @@ export namespace std using std::is_scoped_enum; using std::is_scoped_enum_v; #endif +#if __cpp_lib_is_implicit_lifetime + using std::is_implicit_lifetime; + using std::is_implicit_lifetime_v; +#endif } // diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++2011/42319.cc b/libstdc++-v3/testsuite/17_intro/headers/c++2011/42319.cc index cd576cad2979..350a5481dbd4 100644 --- a/libstdc++-v3/testsuite/17_intro/headers/c++2011/42319.cc +++ b/libstdc++-v3/testsuite/17_intro/headers/c++2011/42319.cc @@ -1,5 +1,5 @@ // { dg-do compile } -// { dg-options "-std=gnu++11" } +// { dg-add-options no_pch } // Copyright (C) 2009-2025 Free Software Foundation, Inc. // @@ -19,4 +19,4 @@ // . // libstdc++/42319 -#include +#include diff --git a/libstdc++-v3/testsuite/20_util/is_implicit_lifetime/value.cc b/libstdc++-v3/testsuite/20_util/is_implicit_lifetime/value.cc new file mode 100644 index 000000000000..d8cb181e9af4 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_implicit_lifetime/value.cc @@ -0,0 +1,129 @@ +// Copyright (C) 2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// { dg-do compile { target c++23 } } +// { dg-add-options no_pch } + +#include + +#ifndef __cpp_lib_is_implicit_lifetime +# error "Feature test macro for is_implicit_lifetime is missing in " +#elif __cpp_lib_is_implicit_lifetime < 202302L +# error "Feature test macro for is_implicit_lifetime has wrong value in " +#endif + +#include + +template + concept Is_implicit_lifetime + = __gnu_test::test_category(true); + +static_assert( ! Is_implicit_lifetime ); +static_assert( ! Is_implicit_lifetime ); +static_assert( ! Is_implicit_lifetime ); +static_assert( Is_implicit_lifetime ); +static_assert( Is_implicit_lifetime ); +static_assert( Is_implicit_lifetime ); +static_assert( Is_implicit_lifetime ); +static_assert( Is_implicit_lifetime ); +static_assert( Is_implicit_lifetime ); +static_assert( Is_implicit_lifetime ); +static_assert( Is_implicit_lifetime ); +static_assert( Is_implicit_lifetime ); +static_assert( Is_implicit_lifetime ); +static_assert( Is_implicit_lifetime ); +static_assert( Is_implicit_lifetime ); +static_assert( Is_implicit_lifetime ); +static_assert( Is_implicit_lifetime ); +enum W { W1 }; +static_assert( Is_implicit_lifetime ); +enum class X : int { X1 }; +static_assert( Is_implicit_lifetime ); +static_assert( Is_implicit_lifetime ); +static_assert( Is_implicit_lifetime ); +struct Y { int g; int foo (int); }; +static_assert( Is_implicit_lifetime ); +static_assert( Is_implicit_lifetime ); +static_assert( ! Is_implicit_lifetime ); +static_assert( ! Is_implicit_lifetime ); +static_assert( Is_implicit_lifetime ); +static_assert( Is_implicit_lifetime ); +static_assert( Is_implicit_lifetime ); +static_assert( ! Is_implicit_lifetime ); +static_assert( ! Is_implicit_lifetime ); +static_assert( ! Is_implicit_lifetime ); +static_assert( ! Is_implicit_lifetime ); +struct Z; +static_assert( Is_implicit_lifetime ); +static_assert( Is_implicit_lifetime ); +struct A { int a, b, c; }; +static_assert( Is_implicit_lifetime ); +class B { static int a; private: static int b; public: int c; }; +static_assert( Is_implicit_lifetime ); +struct C { C () {} int a, b, c; }; +static_assert( Is_implicit_lifetime ); +struct D { explicit D (int) {} int a, b, c; }; +static_assert( Is_implicit_lifetime ); +struct E : public A { int d, e, f; }; +static_assert( Is_implicit_lifetime ); +struct F : public C { using C::C; int d, e, f; }; +static_assert( Is_implicit_lifetime ); +class G { int a, b; }; +static_assert( Is_implicit_lifetime ); +struct H { private: int a, b; }; +static_assert( Is_implicit_lifetime ); +struct I { protected: int a, b; }; +static_assert( Is_implicit_lifetime ); +struct J { int a, b; void foo (); }; +static_assert( Is_implicit_lifetime ); +struct K { int a, b; virtual void foo (); }; +static_assert( ! Is_implicit_lifetime ); +struct L : virtual public A { int d, e; }; +static_assert( ! Is_implicit_lifetime ); +struct M : protected A { int d, e; }; +static_assert( Is_implicit_lifetime ); +struct N : private A { int d, e; }; +static_assert( Is_implicit_lifetime ); +struct O { O () = delete; int a, b, c; }; +static_assert( Is_implicit_lifetime ); +struct P { P () = default; int a, b, c; }; +static_assert( Is_implicit_lifetime

); +struct Q { Q (); Q (const Q &); int a, b, c; }; +static_assert( ! Is_implicit_lifetime ); +struct R { R (); R (const R &); R (R &&) = default; int a, b, c; }; +static_assert( Is_implicit_lifetime ); +struct S { S (); ~S (); int a, b, c; }; +static_assert( ! Is_implicit_lifetime ); +static_assert( Is_implicit_lifetime ); +struct T { T (); ~T () = default; int a, b, c; }; +static_assert( Is_implicit_lifetime ); +struct U { U (); U (const U &) = default; int a, b, c; }; +static_assert( Is_implicit_lifetime ); +struct V { V () = default; V (const V &); int a, b, c; }; +static_assert( Is_implicit_lifetime ); +struct AA { Q a; Q b; }; +static_assert( Is_implicit_lifetime ); +struct AB { Q a; Q b; ~AB () = default; }; +static_assert( Is_implicit_lifetime ); +struct AC { Q a; Q b; ~AC () {} }; +static_assert( ! Is_implicit_lifetime ); +struct AD : public Q {}; +static_assert( Is_implicit_lifetime ); +struct AE : public Q { ~AE () = default; }; +static_assert( Is_implicit_lifetime ); +struct AF : public Q { ~AF () {} }; +static_assert( ! Is_implicit_lifetime ); diff --git a/libstdc++-v3/testsuite/20_util/is_implicit_lifetime/version.cc b/libstdc++-v3/testsuite/20_util/is_implicit_lifetime/version.cc new file mode 100644 index 000000000000..ed90b47c8662 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_implicit_lifetime/version.cc @@ -0,0 +1,27 @@ +// Copyright (C) 2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// { dg-do compile { target c++23 } } +// { dg-add-options no_pch } + +#include + +#ifndef __cpp_lib_is_implicit_lifetime +# error "Feature test macro for is_implicit_lifetime is missing in " +#elif __cpp_lib_is_implicit_lifetime < 202302L +# error "Feature test macro for is_implicit_lifetime has wrong value in " +#endif diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/atomic/pr118757.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/atomic/pr118757.cc index d54abd8a0392..f49ae38aa669 100644 --- a/libstdc++-v3/testsuite/20_util/shared_ptr/atomic/pr118757.cc +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/atomic/pr118757.cc @@ -1,4 +1,5 @@ // { dg-do run { target c++20 } } +// { dg-additional-options "-pthread" { target pthread } } // { dg-require-gthreads "" } // { dg-require-effective-target hosted } diff --git a/libstdc++-v3/testsuite/20_util/tuple/requirements/empty_trivial.cc b/libstdc++-v3/testsuite/20_util/tuple/requirements/empty_trivial.cc new file mode 100644 index 000000000000..ee18bb3145ea --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/tuple/requirements/empty_trivial.cc @@ -0,0 +1,17 @@ +// { dg-do compile { target c++11 } } + +#include +#include + +// Check that tuple<> has the expected trivial properties +static_assert(std::is_trivially_copyable>::value, + "tuple<> should be trivially copyable"); +static_assert(std::is_trivially_copy_constructible>::value, + "tuple<> should be trivially copy constructible"); +static_assert(std::is_trivially_move_constructible>::value, + "tuple<> should be trivially move constructible"); +static_assert(std::is_trivially_copy_assignable>::value, + "tuple<> should be trivially copy assignable"); +static_assert(std::is_trivially_move_assignable>::value, + "tuple<> should be trivially move assignable"); + diff --git a/libstdc++-v3/testsuite/20_util/weak_ptr/pr118757.cc b/libstdc++-v3/testsuite/20_util/weak_ptr/pr118757.cc index f048f13aec25..77757f3c6c2a 100644 --- a/libstdc++-v3/testsuite/20_util/weak_ptr/pr118757.cc +++ b/libstdc++-v3/testsuite/20_util/weak_ptr/pr118757.cc @@ -1,4 +1,5 @@ // { dg-do run { target c++20 } } +// { dg-additional-options "-pthread" { target pthread } } // { dg-require-gthreads "" } // { dg-require-effective-target hosted } diff --git a/libstdc++-v3/testsuite/23_containers/tuple/cons/119721.cc b/libstdc++-v3/testsuite/23_containers/tuple/cons/119721.cc new file mode 100644 index 000000000000..1d152386fb7b --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/tuple/cons/119721.cc @@ -0,0 +1,121 @@ +// { dg-do run { target c++23 } } + +// Test for PR libstdc++/119721: tuple<> construction/assignment with array + +#include +#include +#include +#include + +constexpr void +test01() +{ + std::array a{}; + + // Constructor from array + std::tuple<> t1(a); + std::tuple<> t2(std::move(a)); + + // Assignment from array + std::tuple<> t3; + t3 = a; + t3 = std::move(a); + + VERIFY( t1 == a ); + VERIFY( t2 == a ); + VERIFY( t3 == a ); +} + +constexpr void +test02() +{ + // Test with non-comparable element type + struct NonComparable + { + void operator==(const NonComparable&) const = delete; + void operator<=>(const NonComparable&) const = delete; + }; + + std::array a{}; + + std::tuple<> t1(a); + std::tuple<> t2(std::move(a)); + + std::tuple<> t3; + t3 = a; + t3 = std::move(a); + + VERIFY( t1 == a ); +} + +constexpr void +test03() +{ + // Test assignment return type (non-const assignment) + std::tuple<> t, u; + std::tuple<>& r1 = (t = u); + VERIFY( &r1 == &t ); + + std::tuple<>& r2 = (t = {}); + VERIFY( &r2 == &t ); + + std::array a{}; + std::tuple<>& r3 = (t = a); + VERIFY( &r3 == &t ); +} + +constexpr void +test04() +{ + std::array a{}; + const std::tuple<> t1; + + // Const assignment from array + std::tuple<> t2; + const std::tuple<>& r1 = (t1 = t2); + VERIFY( &r1 == &t1 ); + const std::tuple<>& r2 = (t1 = std::move(t2)); + VERIFY( &r2 == &t1 ); + + const std::tuple<>& r3 = (t1 = {}); + VERIFY( &r3 == &t1 ); + + // Const assignment from array + const std::tuple<>& r4 = (t1 = a); + VERIFY( &r4 == &t1 ); + const std::tuple<>& r5 = (t1 = std::move(a)); + VERIFY( &r5 == &t1 ); +} + +void +test05() +{ + std::array a{}; + std::allocator alloc; + + // Allocator constructor from array + std::tuple<> t1(std::allocator_arg, alloc, a); + std::tuple<> t2(std::allocator_arg, alloc, std::move(a)); + + VERIFY( t1 == a ); + VERIFY( t2 == a ); +} + +int main() +{ + auto test_all = [] { + test01(); + test02(); + test03(); + test04(); + return true; + }; + + test_all(); + static_assert( test_all() ); + + // allocator test is not constexpr + test05(); + return 0; +} + diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable/members/116586.cc b/libstdc++-v3/testsuite/30_threads/condition_variable/members/116586.cc index 71140078d418..e8c3e1634e27 100644 --- a/libstdc++-v3/testsuite/30_threads/condition_variable/members/116586.cc +++ b/libstdc++-v3/testsuite/30_threads/condition_variable/members/116586.cc @@ -1,4 +1,7 @@ // { dg-do run { target c++11 } } +// { dg-additional-options "-pthread" { target pthread } } +// { dg-require-gthreads "" } +// { dg-require-effective-target hosted } #include #include diff --git a/libstdc++-v3/testsuite/30_threads/future/members/116586.cc b/libstdc++-v3/testsuite/30_threads/future/members/116586.cc index b7cd12c6009c..82f1e5c1be24 100644 --- a/libstdc++-v3/testsuite/30_threads/future/members/116586.cc +++ b/libstdc++-v3/testsuite/30_threads/future/members/116586.cc @@ -1,4 +1,7 @@ // { dg-do run { target c++11 } } +// { dg-additional-options "-pthread" { target pthread } } +// { dg-require-gthreads "" } +// { dg-require-effective-target hosted } #include #include diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_until/116586.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_until/116586.cc index 941f3af16b98..25a78e72f465 100644 --- a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_until/116586.cc +++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_until/116586.cc @@ -1,4 +1,7 @@ // { dg-do run { target c++11 } } +// { dg-additional-options "-pthread" { target pthread } } +// { dg-require-gthreads "" } +// { dg-require-effective-target hosted } #include #include diff --git a/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/try_lock_until/116586.cc b/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/try_lock_until/116586.cc index cebbb3a258d9..5736b7dc0470 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/try_lock_until/116586.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/try_lock_until/116586.cc @@ -1,4 +1,7 @@ // { dg-do run { target c++14 } } +// { dg-additional-options "-pthread" { target pthread } } +// { dg-require-gthreads "" } +// { dg-require-effective-target hosted } #include #include @@ -8,10 +11,18 @@ namespace chrono = std::chrono; -// thread.timedmutex.requirements.general: +// [thread.timedmutex.requirements.general]: // If abs_time has already passed, the function attempts to obtain // ownership without blocking (as if by calling try_lock()). +// C++14 [thread.sharedtimedmutex.class] 3.2 says it's undefined for a thread +// to attempt to recursively gain any ownership of a shared_timed_mutex. +// This isn't just theoretical, as Glibc's pthread_rwlock_timedrdlock will +// return EDEADLK if called on the same thread that already holds the +// exclusive (write) lock. +#define VERIFY_IN_NEW_THREAD(X) \ + (void) std::async(std::launch::async, [&] { VERIFY(X); }) + template void test_exclusive_absolute(chrono::nanoseconds offset) @@ -19,7 +30,7 @@ test_exclusive_absolute(chrono::nanoseconds offset) std::shared_timed_mutex stm; chrono::time_point tp(offset); VERIFY(stm.try_lock_until(tp)); - VERIFY(!stm.try_lock_until(tp)); + VERIFY_IN_NEW_THREAD(!stm.try_lock_until(tp)); } template @@ -32,15 +43,7 @@ test_shared_absolute(chrono::nanoseconds offset) stm.unlock_shared(); VERIFY(stm.try_lock_for(chrono::seconds{10})); - - { - // NPTL will give us EDEADLK if pthread_rwlock_timedrdlock() is called on - // the same thread that already holds the exclusive (write) lock, so let's - // arrange for a different thread to try to acquire the shared lock. - auto t = std::async(std::launch::async, [&stm, tp]() { - VERIFY(!stm.try_lock_shared_until(tp)); - }); - } + VERIFY_IN_NEW_THREAD(!stm.try_lock_shared_until(tp)); } // The type of clock used for the actual wait depends on whether @@ -53,7 +56,7 @@ test_exclusive_relative(chrono::nanoseconds offset) std::shared_timed_mutex stm; const auto d = -Clock::now().time_since_epoch() + offset; VERIFY(stm.try_lock_for(d)); - VERIFY(!stm.try_lock_for(d)); + VERIFY_IN_NEW_THREAD(!stm.try_lock_for(d)); } template @@ -66,7 +69,7 @@ test_shared_relative(chrono::nanoseconds offset) stm.unlock_shared(); // Should complete immediately VERIFY(stm.try_lock_for(chrono::seconds{10})); - VERIFY(!stm.try_lock_shared_for(d)); + VERIFY_IN_NEW_THREAD(!stm.try_lock_shared_for(d)); } int main() diff --git a/libstdc++-v3/testsuite/30_threads/thread/swap/1.cc b/libstdc++-v3/testsuite/30_threads/thread/swap/1.cc index 9616b150d240..b1fde096e67d 100644 --- a/libstdc++-v3/testsuite/30_threads/thread/swap/1.cc +++ b/libstdc++-v3/testsuite/30_threads/thread/swap/1.cc @@ -23,7 +23,7 @@ #include #include -#include // std::move +#include // std::move #include void f() { } diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/116586.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/116586.cc index dcba7aa2f8ca..156622818912 100644 --- a/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/116586.cc +++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/116586.cc @@ -1,4 +1,7 @@ // { dg-do run { target c++11 } } +// { dg-additional-options "-pthread" { target pthread } } +// { dg-require-gthreads "" } +// { dg-require-effective-target hosted } #include #include