diff options
Diffstat (limited to 'gcc')
32 files changed, 1311 insertions, 32 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 78239f0..94cb5ae 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,92 @@ +2025-07-02 H.J. Lu <hjl.tools@gmail.com> + + PR target/120908 + * config/i386/i386.cc (legitimize_tls_address): Pass RDI to + gen_tls_global_dynamic_64. + * config/i386/i386.md (*tls_global_dynamic_64_<mode>): Add RDI + clobber and use it to generate LEA. + (@tls_global_dynamic_64_<mode>): Add a clobber. + +2025-07-02 Alexey Merzlyakov <alexey.merzlyakov@samsung.com> + + PR target/120356 + * config/riscv/riscv-v.cc + (expand_const_vector_interleaved_stepped_npatterns): + Fix ASHIFT to LSHIFTRT insn. + +2025-07-02 Richard Biener <rguenther@suse.de> + + PR tree-optimization/120927 + * tree-vect-loop.cc (vect_analyze_loop): Stop querying + further epilogues after one with partial vectors. + +2025-07-02 Haochen Jiang <haochen.jiang@intel.com> + + * config/i386/driver-i386.cc (host_detect_local_cpu): Change + to AMX-FP8 for Diamond Rapids. + +2025-07-01 Qing Zhao <qing.zhao@oracle.com> + + * tree-object-size.cc (access_with_size_object_size): Update comments + for pointers with .ACCESS_WITH_SIZE. + (collect_object_sizes_for): Propagate size info through GIMPLE_ASSIGN + for pointers with .ACCESS_WITH_SIZE. + +2025-07-01 Qing Zhao <qing.zhao@oracle.com> + + * doc/extend.texi: Extend counted_by attribute to pointer fields in + structures. Add one more requirement to pointers with counted_by + attribute. + +2025-07-01 Jakub Jelinek <jakub@redhat.com> + + PR c++/120471 + * tree.h (address_invariant_p): New function. + * tree.cc (address_invariant_p): New function. + (tree_invariant_p_1): Use it for ADDR_EXPR handling. Formatting + tweak. + +2025-07-01 Remi Machet <rmachet@nvidia.com> + + * config/aarch64/aarch64-simd.md (*shrn_to_subhn_<mode>): Add pattern + converting mvn+shrn into mvni+subhn. + +2025-07-01 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/120608 + * passes.def (pass_musttail): Move before pass_sanopt. + * tree-tailcall.cc (empty_eh_cleanup): Handle GIMPLE_RESX + which doesn't throw externally through recursion on single + eh edge (if any and cnt still allows that). + (find_tail_calls): Add ESUCC, IGNORED_EDGES and MUST_SEE_BBS + arguments. Handle GIMPLE_CONDs for non-simplified cleanups with + finally_tmp temporaries both on backward and forward walks, adjust + recursive call. + (tree_optimize_tail_calls_1): Adjust find_tail_calls callers. + +2025-07-01 Ezra Sitorus <ezra.sitorus@arm.com> + + * config/aarch64/aarch64-sys-regs.def: Copy from Binutils. + +2025-07-01 H.J. Lu <hjl.tools@gmail.com> + + PR debug/120902 + * print-tree.cc (debug with const tree_node *): Call debug_tree + instead of debug. + +2025-07-01 Yuao Ma <c8ef@outlook.com> + + * fold-const-call.cc (fold_const_call_ss): Constant fold for + single arg pi-based trigonometric builtins. + (fold_const_call_sss): Constant fold for double arg pi-based + trigonometric builtins. + * fold-const.cc (negate_mathfn_p): asinpi/atanpi is odd func. + (tree_call_nonnegative_warnv_p): acospi always non-neg, + asinpi/atanpi non-neg iff arg non-neg. + * tree-call-cdce.cc (can_test_argument_range): Add acospi/asinpi. + (edom_only_function): Add acospi/asinpi/cospi/sinpi. + (get_no_error_domain): Add acospi/asinpi. + 2025-06-30 Jeff Law <jlaw@ventanamicro.com> PR rtl-optimization/120242 diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index ac92899..6952979 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20250701 +20250703 diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 88b27a8..8aaa006 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,405 @@ +2025-07-01 Eric Botcazou <ebotcazou@adacore.com> + + PR ada/120705 + * exp_ch6.adb (Needs_BIP_Collection): Always return False if the + type has relaxed finalization. + +2025-07-01 Eric Botcazou <ebotcazou@adacore.com> + + * libgnat/s-valuef.adb (Integer_to_Fixed): Restore rounding of the + first scaled divide operation. + +2025-07-01 Piotr Trojanek <trojanek@adacore.com> + + * gnat1drv.adb (Gnat1drv): Do minimal decoration of the spec and body + of an ignored ghost compilation unit. + +2025-07-01 Piotr Trojanek <trojanek@adacore.com> + + * ali.ads (Unit_Record): Fix grammar in comment. + * bindgen.adb (Num_Elab_Calls, Num_Primary_Stacks): Remove counters + that were only incremented and never actually used. + +2025-07-01 Tonu Naks <naks@adacore.com> + + * libgnat/s-valuer.adb (Scan_Decimal_Digits, + Scan_Integral_Digits): fix condition for rejecting + underscore. + +2025-07-01 Eric Botcazou <ebotcazou@adacore.com> + + * libgnat/s-valued.adb (Integer_To_Decimal): Deal specifically with + Val = 2**(Int'Size - 1) if Minus is not set. Exit the loops when V + saturates to 0 in the case of (huge) negative exponents. Use Base + instead of B consistently in unsigned computations. + * libgnat/s-valuef.adb (Integer_To_Fixed): Use Base instead of B + consistently in unsigned computations. + +2025-07-01 Piotr Trojanek <trojanek@adacore.com> + + * exp_ch4.adb (Fixup_Universal_Fixed_Operation): Move to spec. + * exp_ch4.ads (Fixup_Universal_Fixed_Operation): Move from body. + * exp_spark.adb (Expand_SPARK): Call a fixup expansion routine. + +2025-07-01 Gary Dismukes <dismukes@adacore.com> + + * exp_ch3.adb (Build_Heap_Or_Pool_Allocator): Test not Has_Relaxed_Finalization + as a guard against retrieving BIP_Collection formal (and related code). + +2025-07-01 Javier Miranda <miranda@adacore.com> + + * exp_ch3.adb (Build_Untagged_Record_Equality): Report the + warning when no component of an untagged record type U is a + record type, and the type C of some of its components has + defined its user-defined equality operator "=". + * exp_ch4.adb (Expand_Composite_Equality): Report the warning + calling Warn_On_Ignored_Equality_Operator. + * sem_warn.ads (Warn_On_Ignored_Equality_Operator): New subprogram. + * sem_warn.adb (Warn_On_Ignored_Equality_Operator): Factorize code + reporting the warning. + +2025-07-01 Tonu Naks <naks@adacore.com> + + * libgnat/a-ngelfu.adb: conditional computation of X^2 + +2025-07-01 Steve Baird <baird@adacore.com> + + * Makefile.rtl: Add entry for new unit's object file. + * libgnat/s-casuti.adb: Remove bodies of subprograms that were moved + to the new unit. + * libgnat/s-casuti.ads: Replace (with renamings) declarations for + subprograms that moved to the new unit. + * libgnat/s-cautns.adb: Body for new unit (a new source file). + * libgnat/s-cautns.ads: Spec for new unit (a new source file). + * libgnat/s-valuti.adb: Use the new unit instead of the old one. + * gcc-interface/Make-lang.in: Add entries for new unit's object file. + * gcc-interface/Makefile.in: Likewise. + +2025-07-01 Gary Dismukes <dismukes@adacore.com> + + * sem_ch3.adb (Constrain_Corresponding_Record): Inherit Class_Wide_Type on the + created constrained subtype. + +2025-07-01 Artur Pietrek <pietrek@adacore.com> + + * doc/gnat_ugn/building_executable_programs_with_gnat.rst: add + GNAT LLVM explicit selection in GPR file + * gnat_ugn.texi: Regenerate. + +2025-07-01 Eric Botcazou <ebotcazou@adacore.com> + + * exp_ch7.adb (Shift_Address_For_Descriptor): Add dummy variable + to make sure that System_Storage_Elements is loaded. + +2025-07-01 Ronan Desplanques <desplanques@adacore.com> + + * doc/gnat_rm/gnat_language_extensions.rst: Document new extension. + * gen_il-fields.ads (Opt_Field_Enum): Add new fields. + * gen_il-types.ads (N_Loop_Flow_Statement, N_Continue_Statement): New + node kinds. + * gen_il-gen-gen_nodes.adb (N_Loop_Flow_Statement): New abstract node + kind. + (N_Continue_Statement): New node kind. + (N_Exit_Statement): Reparent below N_Loop_Flow_Statement. + * sinfo.ads (N_Continue_Statement): Add description. + * sinfo-utils.ads (Loop_Flow_Keyword): New function. + * sinfo-utils.adb (Loop_Flow_Keyword): New function. + * gen_il-gen-gen_entities.adb (E_Loop): Add new field. + * einfo.ads (Continue_Mark): Document new field. + * sprint.adb (Sprint_Node_Actual): Update for new node kind. + * snames.ads-tmpl: Add new keyword. + * par-ch5.adb (P_Continue_Statement, Parse_Loop_Flow_Statement): New + functions. + (P_Sequence_Of_Statements): Handle continue statements. + (P_Exit_Statement): Use Parse_Loop_Flow_Statement. + * sem.adb (Analyze): Handle new node kind. + * sem_ch5.adb (Analyze_Loop_Flow_Statement): New function. + (Analyze_Continue_Statement): New procedure. + (Analyze_Exit_Statement): Use new Analyze_Loop_Flow_Statement function. + * sem_ch5.ads (Analyze_Continue_Statement): New procedure. + * expander.adb (Expand): Handle new node kind. + * exp_ch5.ads (Expand_N_Continue_Statement): New procedure. + * exp_ch5.adb (Expand_Loop_Flow_Statement): New procedure. + (Expand_N_Continue_Statement): New procedure. + (Expand_N_Exit_Statement): Use new Expand_Loop_Flow_Statement + procedure. + (Build_Formal_Container_Iteration): Always reuse original loop entity. + * gnat_rm.texi: Regenerate. + +2025-07-01 Bob Duff <duff@adacore.com> + + * repinfo.adb (List_Entities): + Disable output in case of object renamings. + +2025-07-01 Aleksandra Pasek <pasek@adacore.com> + + * libgnat/s-valuen.ads: Correct comment. + +2025-07-01 Alexandre Oliva <oliva@adacore.com> + + * init.c: Include string.h. + +2025-07-01 Tonu Naks <naks@adacore.com> + + * doc/gnat_rm.rst: remove ref to 2012 chapter + * doc/gnat_rm/about_this_guide.rst: remove ref to 2012 chapter + * doc/gnat_rm/compatibility_and_porting_guide.rst: update list of + supported versions + * doc/gnat_rm/implementation_of_ada_2012_features.rst: delete + * doc/gnat_rm/specialized_needs_annexes.rst: update list of + supported versions + * gnat_rm.texi: Regenerate. + +2025-07-01 Tonu Naks <naks@adacore.com> + + * doc/gnat_rm/implementation_advice.rst: remove GLADE + * doc/gnat_rm/implementation_defined_characteristics.rst: remove GLADE + * doc/gnat_rm/specialized_needs_annexes.rst: remove GLADE + * doc/gnat_rm/the_gnat_library.rst: remove GLADE + * gnat_rm.texi: Regenerate. + +2025-07-01 Alexandre Oliva <oliva@adacore.com> + + * adaint.c [__vxworks] (alloca): Redirect to builtin. + +2025-07-01 Ghjuvan Lacambre <lacambre@adacore.com> + + * freeze.adb (Freeze_Record_Type): Check for CodePeer_Mode. + +2025-07-01 Piotr Trojanek <trojanek@adacore.com> + + * sem_ch12.adb (Analyze_Subprogram_Instantiation): Move aspects when + instantiating subprogram as a library unit. + +2025-07-01 Ronan Desplanques <desplanques@adacore.com> + + * exp_ch5.adb (Expand_N_Loop_Statement): Remove useless subexpressions. + +2025-07-01 Jose Ruiz <ruiz@adacore.com> + + * doc/gnat_ugn/gnat_and_program_execution.rst: Add the + documentation about benefits of using sanitizers in + mixed-language applications. + * gnat_ugn.texi: Regenerate. + +2025-07-01 Viljar Indus <indus@adacore.com> + + * atree.ads (Compile_Time_Pragma_Warnings): Removed. + * errout.adb (Initialize): Remove initialization for + Compile_Time_Pragma_Warnings. + (Error_Msg_Internal): Use Warning_As_Error_Kind in the + Error_Msg_Object. Set its value based on the reason the + warning was changed to an error. + (Write_JSON_Span): Adjust the code for Warn_Err. + (Output_Messages): Update the calculation for actual warnings + and errors by just using Warnings_Treated_As_Errors. + (Set_Msg_Text): Simply mark that we are dealing with a + run time message here. Move the code for the Warning_Mode to + Error_Msg_Internal. + * erroutc-pretty_emitter.adb (Write_Error_Msg_Line): Adjust the code + for Warn_Err. Use the Warn_As_Err_Tag token. + * erroutc.adb (Compilation_Errors): Simplify the implementation so + that it only checks for errors and warnings treated as errors. + (Decrease_Error_Msg_Count): Remove the count for + Compile_Time_Pragma_Warnings. + (dmsg): Adjust the code for changes to Warn_Err. + (Increase_Error_Msg_Count): Likewise and remove the count for + Compile_Time_Pragma_Warnings. + (Output_Msg_Text): Warnings converted to error by the + Warning_As_Error pragma and -gnatwE now use the error prefix + in their messages but only warnings changed by the pragma get + the [warning-as-error] tag. + (Output_Text_Within): Adjust the variable name for + Is_Runtime_Raise_Msg. + (Write_Error_Summary): Adjust printing of warnings so that it + just uses the counts for Warnings_Detected and + Warnings_Treated_As_Errors. + * erroutc.ads (Is_Runtime_Raise): renamed to Is_Runtime_Raise_Msg. + (Warning_As_Error_Kind): New type for marking the warning message + is treated as an error which also captures the reason for the + change. Historically each of the reasons will have a different way + of displaying the warning message. + (Error_Msg_Object.Warn_Err): Change type to Warning_As_Error_Kind. + (Kind_To_String): Warnings treated as errors originating from + the pragma or -gnatwE will return error where as warnings + originating from -gnatwe will return warning. + (Compilation_Errors): Update the documentation. + (Warn_As_Err_Tag): Constant string to be used when printing warnings + as errors. + * errutil.adb (Error_Msg): Adjust the code for Warn_Err. + +2025-07-01 Eric Botcazou <ebotcazou@adacore.com> + + * exp_ch7.adb (Shift_Address_For_Descriptor): New function. + (Make_Address_For_Finalize): Call above function. + (Make_Finalize_Address_Stmts): Likewise. + * exp_util.ads (Is_Constr_Array_Subt_Of_Unc_With_Controlled): New + predicate. + * exp_util.adb (Is_Constr_Array_Subt_Of_Unc_With_Controlled): Ditto. + (Remove_Side_Effects): Call above predicate. + * sem_ch3.adb (Analyze_Object_Declaration): Likewise. + * sem_ch4.adb (Analyze_Allocator): Allocate the bounds by setting + Is_Constr_Array_Subt_With_Bounds when appropriate. + +2025-07-01 Javier Miranda <miranda@adacore.com> + + * sem_ch4.adb (Try_Object_Operation): Handle mutably tagged + class-wide type prefix. + +2025-07-01 Viljar Indus <indus@adacore.com> + + * errout.adb (Error_Msg_Internal): Use the new + Warning_Treated_As_Error function. + * erroutc.adb (Get_Warning_Option): Add new version of this + function that operates on the Error_Msg_Object directly instead + of the Error_Id. Update the existing function to call the new + version interanlly. + (Get_Warning_Tag): Likewise. + (Warning_Treated_As_Error): Add a new method that combines the + checks for the error message itself and its tag. + * erroutc.ads (Get_Warning_Option): Add new spec. + (Get_Warning_Option): Likewise. + (Get_Warning_Option): Likewise. + +2025-07-01 Viljar Indus <indus@adacore.com> + + * atree.ads: Add Compile_Time_Pragma_Warnings for counting + compile time warnings. + * errout.adb (Initialize): Initialize Compile_Time_Pragma_Warnings. + (Output_Messages): Use Compile_Time_Pragma_Warnings instead of + Count_Compile_Time_Pragma_Warnings. + * erroutc.adb (Compilation_Errors): Likewise. + (Count_Compile_Time_Pragma_Warnings): Removed. + (Decrease_Error_Msg_Count): Update Compile_Time_Pragma_Warnings. + (Increase_Error_Msg_Count): Likewise. + (Write_Error_Summary): Use Compile_Time_Pragma_Warnings instead of + Count_Compile_Time_Pragma_Warnings. + * erroutc.ads (Count_Compile_Time_Pragma_Warnings): Removed. + +2025-07-01 Viljar Indus <indus@adacore.com> + + * errout.adb (Delete_Warning_And_Continuations): Use + Decrease_Error_Msg_Count to update the message counts. + (Delete_Warning): Likewise. + (To_Be_Removed): Likewise. + +2025-07-01 Viljar Indus <indus@adacore.com> + + * errout.adb (Remove_Warning_Messages): Mark removed messages as + deleted. + * erroutc.adb (Purge_Messages): Likewise. + +2025-07-01 Martin Clochard <clochard@adacore.com> + + * frontend.adb (Frontend): do not override GNATprove's setting for + Warn_On_Non_Local_Exception + +2025-07-01 Eric Botcazou <ebotcazou@adacore.com> + + * sem_ch4.adb (Analyze_Allocator): Do not set Etype to itself. + +2025-07-01 Eric Botcazou <ebotcazou@adacore.com> + + * exp_util.adb (Finalize_Address): Do not go to the root type for + array types. + +2025-07-01 Eric Botcazou <ebotcazou@adacore.com> + + * libgnat/s-valuer.ads (System.Value_R): Remove Round parameter. + (Scan_Raw_Real): Replace Extra with Extra2 and adjust the comment. + (Value_Raw_Real): Likewise. + * libgnat/s-valuer.adb (Round_Extra): Delete. + (Scan_Decimal_Digits): Replace Extra with Extra2 and adjust the + implementation. + (Scan_Integral_Digits): Replace Extra with Extra2 and Extra_Rounded + with Extra2_Filled and adjust the implementation. + (Scan_Raw_Real): Replace Extra with Extra2 and adjust the + implementation. + (Value_Raw_Real): Likewise. + * libgnat/s-valrea.adb (Impl): Remove actual for Round formal. + * libgnat/s-valued.adb (Impl): Likewise. + (Integer_to_Decimal): Replace Extra with Extra2 and adjust the + implementation. Rename Unsigned_To_Signed to To_Signed. + (Scan_Decimal): Replace Extra with Extra2 and adjust the + implementation. + (Value_Decimal): Likewise. + * libgnat/s-valuef.adb (Impl): Remove actual for Round formal. + (Integer_to_Fixed): Replace Extra with Extra2 and adjust the + implementation. Rename Unsigned_To_Signed to To_Signed. Only + round the last scaled divide operation. + (Scan_Fixed): Replace Extra with Extra2 and adjust the + implementation. + (Value_Fixed): Likewise. + +2025-07-01 Ronan Desplanques <desplanques@adacore.com> + + * libgnat/s-valuer.adb (Scan_Decimal_Digits, Scan_Integral_Digits): + Minor rephrasing. + +2025-07-01 Ronan Desplanques <desplanques@adacore.com> + + * sem_ch5.adb (Analyze_Loop_Parameter_Specification): Set ekind + earlier. + +2025-07-01 Eric Botcazou <ebotcazou@adacore.com> + + * exp_util.ads (Is_Finalizable_Access): New predicate. + (Is_Non_BIP_Func_Call): Delete. + (Is_Secondary_Stack_BIP_Func_Call): Likewise. + * exp_util.adb (Is_Finalizable_Access): New predicate. + (Initialized_By_Aliased_BIP_Func_Call): Delete. + (Initialized_By_Reference): Likewise. + (Is_Aliased): Only consider the nontransient object serviced by + the transient scope. + (Is_Part_Of_BIP_Return_Statement): Minor tweak. + (Is_Finalizable_Transient): Remove calls to Initialized_By_Reference + and Initialized_By_Aliased_BIP_Func_Call. + Call Is_Finalizable_Access for access objects. + (Is_Non_BIP_Func_Call): Delete. + (Is_Secondary_Stack_BIP_Func_Call): Likewise. + (Requires_Cleanup_Actions): Call Is_Finalizable_Access for access + objects. + (Side_Effect_Free): Return True for N_Reference. + * exp_ch7.adb (Build_Finalizer.Process_Declarations): Call + Is_Finalizable_Access for access objects. + +2025-07-01 Eric Botcazou <ebotcazou@adacore.com> + + * exp_util.adb (Is_Expression_Of_Func_Return): New predicate. + (Is_Related_To_Func_Return): Call Is_Expression_Of_Func_Return. + (Remove_Side_Effects): Generate a temporary for a function call + that returns a constrained array type with controlled component + and an unconstrained first subtype. + +2025-07-01 Piotr Trojanek <trojanek@adacore.com> + + * inline.adb (Rewrite_Procedure_Call): Replace with a simple rewriting + of procedure call into a single block node, i.e. remove broken + optimization. + * sem_util.adb (Next_Actual): Adapt GNATprove-specific code that peeks + into inlined calls. + +2025-07-01 Martin Clochard <clochard@adacore.com> + + * exp_util.adb (Is_Controlling_Formal_Ref): test scope against + derived subprogram as well. + +2025-07-01 Viljar Indus <indus@adacore.com> + + * errout.adb (Error_Msg_Internal): Relocate Warn_As_Err propagation + to Increase_Error_Msg_Counti. + (Delete_Warning_And_Continuations): Update + Warnings_Treated_As_Errors count. + (Delete_Warning): Likewise. + (To_Be_Removed): Likewise. + * erroutc.adb (Increase_Error_Msg_Count): Count warnings treated + as errors here and perform the propagation of this property to + the parent message. + (Output_Msg_Text): Remove counting of warnings as errors from + here. + (Decrease_Error_Msg_Count): Update Warnings_Treated_As_Errors + count. + 2025-06-30 Eric Botcazou <ebotcazou@adacore.com> PR ada/120106 diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 2cd02b0..dd2ae5c 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,25 @@ +2025-07-01 Qing Zhao <qing.zhao@oracle.com> + + * c-gimplify.cc (is_address_with_access_with_size): New function. + (ubsan_walk_array_refs_r): Instrument an INDIRECT_REF whose base + address is .ACCESS_WITH_SIZE or an address computation whose base + address is .ACCESS_WITH_SIZE. + * c-ubsan.cc (ubsan_instrument_bounds_pointer_address): New function. + (struct factor_t): New structure. + (get_factors_from_mul_expr): New function. + (get_index_from_offset): New function. + (get_index_from_pointer_addr_expr): New function. + (is_instrumentable_pointer_array_address): New function. + (ubsan_array_ref_instrumented_p): Change prototype. + Handle MEM_REF in addtional to ARRAY_REF. + (ubsan_maybe_instrument_array_ref): Handle MEM_REF in addtional + to ARRAY_REF. + +2025-07-01 Qing Zhao <qing.zhao@oracle.com> + + * c-attribs.cc (handle_counted_by_attribute): Accept counted_by + attribute for pointer fields. + 2025-06-30 Jakub Jelinek <jakub@redhat.com> PR c/120520 diff --git a/gcc/c-family/c-gimplify.cc b/gcc/c-family/c-gimplify.cc index c6fb764..e905059 100644 --- a/gcc/c-family/c-gimplify.cc +++ b/gcc/c-family/c-gimplify.cc @@ -66,6 +66,20 @@ along with GCC; see the file COPYING3. If not see walk back up, we check that they fit our constraints, and copy them into temporaries if not. */ + +/* Check whether TP is an address computation whose base is a call to + .ACCESS_WITH_SIZE. */ + +static bool +is_address_with_access_with_size (tree tp) +{ + if (TREE_CODE (tp) == POINTER_PLUS_EXPR + && (TREE_CODE (TREE_OPERAND (tp, 0)) == INDIRECT_REF) + && (is_access_with_size_p (TREE_OPERAND (TREE_OPERAND (tp, 0), 0)))) + return true; + return false; +} + /* Callback for c_genericize. */ static tree @@ -121,6 +135,20 @@ ubsan_walk_array_refs_r (tree *tp, int *walk_subtrees, void *data) walk_tree (&TREE_OPERAND (*tp, 1), ubsan_walk_array_refs_r, pset, pset); walk_tree (&TREE_OPERAND (*tp, 0), ubsan_walk_array_refs_r, pset, pset); } + else if (TREE_CODE (*tp) == INDIRECT_REF + && is_address_with_access_with_size (TREE_OPERAND (*tp, 0))) + { + ubsan_maybe_instrument_array_ref (&TREE_OPERAND (*tp, 0), false); + /* Make sure ubsan_maybe_instrument_array_ref is not called again on + the POINTER_PLUS_EXPR, so ensure it is not walked again and walk + its subtrees manually. */ + tree aref = TREE_OPERAND (*tp, 0); + pset->add (aref); + *walk_subtrees = 0; + walk_tree (&TREE_OPERAND (aref, 0), ubsan_walk_array_refs_r, pset, pset); + } + else if (is_address_with_access_with_size (*tp)) + ubsan_maybe_instrument_array_ref (tp, true); return NULL_TREE; } diff --git a/gcc/c-family/c-ubsan.cc b/gcc/c-family/c-ubsan.cc index 78b7868..38514a4 100644 --- a/gcc/c-family/c-ubsan.cc +++ b/gcc/c-family/c-ubsan.cc @@ -554,38 +554,322 @@ ubsan_instrument_bounds (location_t loc, tree array, tree *index, *index, bound); } -/* Return true iff T is an array that was instrumented by SANITIZE_BOUNDS. */ + +/* Instrument array bounds for the pointer array address which is + an INDIRECT_REF to the call to .ACCESS_WITH_SIZE. We create special + builtin, that gets expanded in the sanopt pass, and make an array + dimention of it. POINTER_ADDR is the pointer array's base address. + *INDEX is an index to the array. + IGNORE_OFF_BY_ONE is true if the POINTER_ADDR is not inside an + INDIRECT_REF. + Return NULL_TREE if no instrumentation is emitted. */ + +tree +ubsan_instrument_bounds_pointer_address (location_t loc, tree pointer_addr, + tree *index, + bool ignore_off_by_one) +{ + gcc_assert (TREE_CODE (pointer_addr) == INDIRECT_REF); + tree call = TREE_OPERAND (pointer_addr, 0); + if (!is_access_with_size_p (call)) + return NULL_TREE; + tree bound = get_bound_from_access_with_size (call); + + if (ignore_off_by_one) + bound = fold_build2 (PLUS_EXPR, TREE_TYPE (bound), bound, + build_int_cst (TREE_TYPE (bound), + 1)); + + /* Don't emit instrumentation in the most common cases. */ + tree idx = NULL_TREE; + if (TREE_CODE (*index) == INTEGER_CST) + idx = *index; + else if (TREE_CODE (*index) == BIT_AND_EXPR + && TREE_CODE (TREE_OPERAND (*index, 1)) == INTEGER_CST) + idx = TREE_OPERAND (*index, 1); + if (idx + && TREE_CODE (bound) == INTEGER_CST + && tree_int_cst_sgn (idx) >= 0 + && tree_int_cst_lt (idx, bound)) + return NULL_TREE; + + *index = save_expr (*index); + + /* Create an array_type for the corresponding pointer array. */ + tree itype = build_range_type (sizetype, size_zero_node, NULL_TREE); + /* The array's element type can be get from the return type of the call to + .ACCESS_WITH_SIZE. */ + tree element_type = TREE_TYPE (TREE_TYPE (TREE_TYPE (call))); + tree array_type = build_array_type (element_type, itype); + /* Create a "(T *) 0" tree node to describe the array type. */ + tree zero_with_type = build_int_cst (build_pointer_type (array_type), 0); + return build_call_expr_internal_loc (loc, IFN_UBSAN_BOUNDS, + void_type_node, 3, zero_with_type, + *index, bound); +} + +/* This structure is to combine a factor with its parent and its position + * in its parent tree. */ +struct factor_t +{ + tree factor; + tree parent; /* the parent tree of this factor. */ + int pos; /* the position of this factor in its parent tree. */ +}; + +/* for a multiply expression like: + ((long unsigned int) m * (long unsigned int) SAVE_EXPR <n>) * 4 + + locate all the factors, the parents of the factor and the position of + the factor in its parent, and put them to VEC_FACTORS. */ + +static void +get_factors_from_mul_expr (tree mult_expr, tree parent, + int pos, auto_vec<factor_t> *vec_factors) +{ + struct factor_t mult_factor = {0, 0, -1}; + mult_factor.factor = mult_expr; + mult_factor.parent = parent; + mult_factor.pos = pos; + + while (CONVERT_EXPR_CODE_P (TREE_CODE (mult_expr))) + { + mult_factor.parent = mult_expr; + mult_factor.pos = 0; + mult_expr = TREE_OPERAND (mult_expr, 0); + mult_factor.factor = mult_expr; + } + if (TREE_CODE (mult_expr) != MULT_EXPR) + vec_factors->safe_push (mult_factor); + else + { + get_factors_from_mul_expr (TREE_OPERAND (mult_expr, 0), mult_expr, + 0, vec_factors); + get_factors_from_mul_expr (TREE_OPERAND (mult_expr, 1), mult_expr, + 1, vec_factors); + } +} + +/* Given an OFFSET expression, and the ELEMENT_SIZE, + get the index expression from OFFSET and return it. + For example: + OFFSET: + ((long unsigned int) m * (long unsigned int) SAVE_EXPR <n>) * 4 + ELEMENT_SIZE: + (sizetype) SAVE_EXPR <n> * 4 + get the index as (long unsigned int) m, and return it. + The INDEX_P holds the pointer to the parent tree of the index, + INDEX_N holds the position of the index in its parent. */ + +static tree +get_index_from_offset (tree offset, tree *index_p, + int *index_n, tree element_size) +{ + if (TREE_CODE (offset) != MULT_EXPR) + return NULL_TREE; + + auto_vec<factor_t> e_factors, o_factors; + get_factors_from_mul_expr (element_size, NULL, -1, &e_factors); + get_factors_from_mul_expr (offset, *index_p, *index_n, &o_factors); + + if (e_factors.is_empty () || o_factors.is_empty ()) + return NULL_TREE; + + bool all_found = true; + for (unsigned i = 0; i < e_factors.length (); i++) + { + factor_t e_size_factor = e_factors[i]; + bool found = false; + for (unsigned j = 0; j < o_factors.length ();) + { + factor_t o_exp_factor = o_factors[j]; + if (operand_equal_p (e_size_factor.factor, o_exp_factor.factor)) + { + o_factors.unordered_remove (j); + found = true; + break; + } + else + j++; + } + if (!found) + all_found = false; + } + + if (!all_found) + return NULL_TREE; + + if (o_factors.length () != 1) + return NULL_TREE; + + *index_p = o_factors[0].parent; + *index_n = o_factors[0].pos; + return o_factors[0].factor; +} + +/* For an pointer + offset computation expression, such as, + *.ACCESS_WITH_SIZE (p->c, &p->b, 1, 0, -1, 0B) + + (sizetype) ((long unsigned int) index * 4 + Return the index of this pointer array reference, + set the parent tree of INDEX to *INDEX_P. + set the operand position of the INDEX in the parent tree to *INDEX_N. + If failed, return NULL_TREE. */ + +static tree +get_index_from_pointer_addr_expr (tree pointer, tree *index_p, int *index_n) +{ + *index_p = NULL_TREE; + *index_n = -1; + if (TREE_CODE (TREE_OPERAND (pointer, 0)) != INDIRECT_REF) + return NULL_TREE; + tree call = TREE_OPERAND (TREE_OPERAND (pointer, 0), 0); + if (!is_access_with_size_p (call)) + return NULL_TREE; + + /* Get the pointee type of the call to .ACCESS_WITH_SIZE. + This should be the element type of the pointer array. */ + tree pointee_type = TREE_TYPE (TREE_TYPE (TREE_TYPE (call))); + tree pointee_size = TYPE_SIZE_UNIT (pointee_type); + + tree index_exp = TREE_OPERAND (pointer, 1); + *index_p = pointer; + *index_n = 1; + + if (!(TREE_CODE (index_exp) != MULT_EXPR + && tree_int_cst_equal (pointee_size, integer_one_node))) + { + while (CONVERT_EXPR_CODE_P (TREE_CODE (index_exp))) + { + *index_p = index_exp; + *index_n = 0; + index_exp = TREE_OPERAND (index_exp, 0); + } + index_exp = get_index_from_offset (index_exp, index_p, + index_n, pointee_size); + + if (!index_exp) + return NULL_TREE; + } + + while (CONVERT_EXPR_CODE_P (TREE_CODE (index_exp))) + { + *index_p = index_exp; + *index_n = 0; + index_exp = TREE_OPERAND (index_exp, 0); + } + + return index_exp; +} + +/* Return TRUE when the EXPR is a pointer array address that could be + instrumented. + We only instrument an address computation similar as the following: + *.ACCESS_WITH_SIZE (p->c, &p->b, 1, 0, -1, 0B) + + (sizetype) ((long unsigned int) index * 4) + if the EXPR is instrumentable, return TRUE and + set the index to *INDEX. + set the *.ACCESS_WITH_SIZE to *BASE. + set the parent tree of INDEX to *INDEX_P. + set the operand position of the INDEX in the parent tree to INDEX_N. */ + +static bool +is_instrumentable_pointer_array_address (tree expr, tree *base, + tree *index, tree *index_p, + int *index_n) +{ + /* For a poiner array address as: + (*.ACCESS_WITH_SIZE (p->c, &p->b, 1, 0, -1, 0B) + + (sizetype) ((long unsigned int) index * 4) + op0 is the call to *.ACCESS_WITH_SIZE; + op1 is the index. */ + if (TREE_CODE (expr) != POINTER_PLUS_EXPR) + return false; + + tree op0 = TREE_OPERAND (expr, 0); + if (TREE_CODE (op0) != INDIRECT_REF) + return false; + if (!is_access_with_size_p (TREE_OPERAND (op0, 0))) + return false; + tree op1 = get_index_from_pointer_addr_expr (expr, index_p, index_n); + if (op1 != NULL_TREE) + { + *base = op0; + *index = op1; + return true; + } + return false; +} + +/* Return true iff T is an array or an indirect reference that was + instrumented by SANITIZE_BOUNDS. */ bool -ubsan_array_ref_instrumented_p (const_tree t) +ubsan_array_ref_instrumented_p (tree t) { - if (TREE_CODE (t) != ARRAY_REF) + if (TREE_CODE (t) != ARRAY_REF + && TREE_CODE (t) != MEM_REF) return false; - tree op1 = TREE_OPERAND (t, 1); - return TREE_CODE (op1) == COMPOUND_EXPR - && TREE_CODE (TREE_OPERAND (op1, 0)) == CALL_EXPR - && CALL_EXPR_FN (TREE_OPERAND (op1, 0)) == NULL_TREE - && CALL_EXPR_IFN (TREE_OPERAND (op1, 0)) == IFN_UBSAN_BOUNDS; + bool is_array = (TREE_CODE (t) == ARRAY_REF); + tree op0 = NULL_TREE; + tree op1 = NULL_TREE; + tree index_p = NULL_TREE; + int index_n = 0; + if (is_array) + { + op1 = TREE_OPERAND (t, 1); + return TREE_CODE (op1) == COMPOUND_EXPR + && TREE_CODE (TREE_OPERAND (op1, 0)) == CALL_EXPR + && CALL_EXPR_FN (TREE_OPERAND (op1, 0)) == NULL_TREE + && CALL_EXPR_IFN (TREE_OPERAND (op1, 0)) == IFN_UBSAN_BOUNDS; + } + else if (is_instrumentable_pointer_array_address (t, &op0, &op1, + &index_p, &index_n)) + return TREE_CODE (op1) == COMPOUND_EXPR + && TREE_CODE (TREE_OPERAND (op1, 0)) == CALL_EXPR + && CALL_EXPR_FN (TREE_OPERAND (op1, 0)) == NULL_TREE + && CALL_EXPR_IFN (TREE_OPERAND (op1, 0)) == IFN_UBSAN_BOUNDS; + + return false; } -/* Instrument an ARRAY_REF, if it hasn't already been instrumented. - IGNORE_OFF_BY_ONE is true if the ARRAY_REF is inside a ADDR_EXPR. */ +/* Instrument an ARRAY_REF or an address computation whose base address is + a call to .ACCESS_WITH_SIZE, if it hasn't already been instrumented. + IGNORE_OFF_BY_ONE is true if the ARRAY_REF is inside a ADDR_EXPR, or the + address computation is not inside a INDIRECT_REF. */ void ubsan_maybe_instrument_array_ref (tree *expr_p, bool ignore_off_by_one) { + tree e = NULL_TREE; + tree op0 = NULL_TREE; + tree op1 = NULL_TREE; + tree index_p = NULL_TREE; /* the parent tree of INDEX. */ + int index_n = 0; /* the operand position of INDEX in the parent tree. */ + if (!ubsan_array_ref_instrumented_p (*expr_p) && sanitize_flags_p (SANITIZE_BOUNDS | SANITIZE_BOUNDS_STRICT) && current_function_decl != NULL_TREE) { - tree op0 = TREE_OPERAND (*expr_p, 0); - tree op1 = TREE_OPERAND (*expr_p, 1); - tree e = ubsan_instrument_bounds (EXPR_LOCATION (*expr_p), op0, &op1, - ignore_off_by_one); + if (TREE_CODE (*expr_p) == ARRAY_REF) + { + op0 = TREE_OPERAND (*expr_p, 0); + op1 = TREE_OPERAND (*expr_p, 1); + index_p = *expr_p; + index_n = 1; + e = ubsan_instrument_bounds (EXPR_LOCATION (*expr_p), op0, + &op1, ignore_off_by_one); + } + else if (is_instrumentable_pointer_array_address (*expr_p, &op0, &op1, + &index_p, &index_n)) + e = ubsan_instrument_bounds_pointer_address (EXPR_LOCATION (*expr_p), + op0, &op1, + ignore_off_by_one); + + /* Replace the original INDEX with the instrumented INDEX. */ if (e != NULL_TREE) - TREE_OPERAND (*expr_p, 1) = build2 (COMPOUND_EXPR, TREE_TYPE (op1), - e, op1); + TREE_OPERAND (index_p, index_n) + = build2 (COMPOUND_EXPR, TREE_TYPE (op1), e, op1); } } diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 89a3210..cb69b8c 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,17 @@ +2025-07-01 Qing Zhao <qing.zhao@oracle.com> + + * c-decl.cc (verify_counted_by_attribute): Change the 2nd argument + to a vector of fields with counted_by attribute. Verify all fields + in this vector. + (finish_struct): Collect all the fields with counted_by attribute + to a vector and pass this vector to verify_counted_by_attribute. + * c-typeck.cc (build_counted_by_ref): Handle pointers with counted_by. + Add one more argument, issue error when the pointee type is a structure + or union including a flexible array member. + (build_access_with_size_for_counted_by): Handle pointers with counted_by. + (handle_counted_by_for_component_ref): Call build_counted_by_ref + with the new prototype. + 2025-06-23 Tobias Burnus <tburnus@baylibre.com> * c-parser.cc (OACC_WAIT_CLAUSE_MASK): Add if clause. diff --git a/gcc/cobol/ChangeLog b/gcc/cobol/ChangeLog index 9b29af8..4b05399 100644 --- a/gcc/cobol/ChangeLog +++ b/gcc/cobol/ChangeLog @@ -1,3 +1,11 @@ +2025-07-01 James K. Lowden <jklowden@cobolworx.com> + + * Make-lang.in: Use && instead of semicolon between commands. + +2025-07-01 Robert Dubner <rdubner@symas.com> + + * parse.y: printf() of size_t is %zu, not %ld. + 2025-06-30 James K. Lowden <jklowden@cobolworx.com> PR cobol/120772 diff --git a/gcc/config/i386/driver-i386.cc b/gcc/config/i386/driver-i386.cc index 63c7d79..fe71f55 100644 --- a/gcc/config/i386/driver-i386.cc +++ b/gcc/config/i386/driver-i386.cc @@ -600,7 +600,7 @@ const char *host_detect_local_cpu (int argc, const char **argv) if (has_feature (FEATURE_AVX512F)) { /* Assume Diamond Rapids. */ - if (has_feature (FEATURE_AMX_TRANSPOSE)) + if (has_feature (FEATURE_AMX_FP8)) cpu = "diamondrapids"; /* Assume Granite Rapids D. */ else if (has_feature (FEATURE_AMX_COMPLEX)) diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc index 44763c8..9657c6a 100644 --- a/gcc/config/i386/i386.cc +++ b/gcc/config/i386/i386.cc @@ -12562,11 +12562,12 @@ legitimize_tls_address (rtx x, enum tls_model model, bool for_mov) if (TARGET_64BIT) { rtx rax = gen_rtx_REG (Pmode, AX_REG); + rtx rdi = gen_rtx_REG (Pmode, DI_REG); rtx_insn *insns; start_sequence (); emit_call_insn - (gen_tls_global_dynamic_64 (Pmode, rax, x, caddr)); + (gen_tls_global_dynamic_64 (Pmode, rax, x, caddr, rdi)); insns = end_sequence (); if (GET_MODE (x) != Pmode) diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index adff2af..370e79b 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -23201,7 +23201,8 @@ (match_operand 3))) (unspec:P [(match_operand 1 "tls_symbolic_operand") (reg:P SP_REG)] - UNSPEC_TLS_GD)] + UNSPEC_TLS_GD) + (clobber (match_operand:P 4 "register_operand" "=D"))] "TARGET_64BIT" { if (!TARGET_X32) @@ -23218,7 +23219,7 @@ Use data16 prefix instead, which doesn't have this problem. */ fputs ("\tdata16", asm_out_file); output_asm_insn - ("lea{q}\t{%E1@tlsgd(%%rip), %%rdi|rdi, %E1@tlsgd[rip]}", operands); + ("lea{q}\t{%E1@tlsgd(%%rip), %q4|%q4, %E1@tlsgd[rip]}", operands); if (TARGET_SUN_TLS || flag_plt || !HAVE_AS_IX86_TLS_GET_ADDR_GOT) fputs (ASM_SHORT "0x6666\n", asm_out_file); else @@ -23265,7 +23266,8 @@ (const_int 0))) (unspec:P [(match_operand 1 "tls_symbolic_operand") (reg:P SP_REG)] - UNSPEC_TLS_GD)])] + UNSPEC_TLS_GD) + (clobber (match_operand:P 3 "register_operand"))])] "TARGET_64BIT" "ix86_tls_descriptor_calls_expanded_in_cfun = true;") diff --git a/gcc/config/riscv/riscv-v.cc b/gcc/config/riscv/riscv-v.cc index 69f2a1ec..ce1633c 100644 --- a/gcc/config/riscv/riscv-v.cc +++ b/gcc/config/riscv/riscv-v.cc @@ -1598,7 +1598,7 @@ expand_const_vector_interleaved_stepped_npatterns (rtx target, rtx src, shifted_vid = gen_reg_rtx (mode); rtx shift = gen_int_mode (1, Xmode); rtx shift_ops[] = {shifted_vid, vid, shift}; - emit_vlmax_insn (code_for_pred_scalar (ASHIFT, mode), BINARY_OP, + emit_vlmax_insn (code_for_pred_scalar (LSHIFTRT, mode), BINARY_OP, shift_ops); } else diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 318d0cd..ff7582d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,13 @@ +2025-07-01 Jakub Jelinek <jakub@redhat.com> + + PR c++/120471 + * typeck.cc (cp_build_array_ref) <case COND_EXPR>: If idx is not + INTEGER_CST, don't optimize the case (but cp_default_conversion on + array early if it has ARRAY_TYPE) or use + SAVE_EXPR <op0>, SAVE_EXPR <idx>, SAVE_EXPR <op0> as new op0 depending + on flag_strong_eval_order and whether op1 and op2 are arrays with + invariant address or tree invariant pointers. Formatting fixes. + 2025-06-28 Nathaniel Shead <nathanieloshead@gmail.com> * module.cc (trees_out::walking_bit_field_unit): New flag. diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 6b44a69..0ea9c39 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,25 @@ +2025-07-01 Harald Anlauf <anlauf@gmx.de> + + * coarray.cc (check_add_new_component): Treat pure and elemental + intrinsic functions the same as non-intrinsic ones. + (create_caf_add_data_parameter_type): Fix front-end memleaks. + * trans-intrinsic.cc (conv_caf_func_index): Likewise. + +2025-07-01 Andre Vehreschild <vehre@gcc.gnu.org> + + PR fortran/120847 + * coarray.cc (check_add_new_comp_handle_array): Make the count + of components static to be able to create more than one. Create + an array component only for array expressions. + +2025-07-01 Andre Vehreschild <vehre@gcc.gnu.org> + + PR fortran/120843 + * resolve.cc (resolve_operator): Report inconsistent coranks + only when not referencing this_image. + (gfc_op_rank_conformable): Treat coranks as inconformable only + when a coindex other then implicit this_image is used. + 2025-06-27 Harald Anlauf <anlauf@gmx.de> PR fortran/120784 diff --git a/gcc/m2/ChangeLog b/gcc/m2/ChangeLog index 04211a0..f7254f9 100644 --- a/gcc/m2/ChangeLog +++ b/gcc/m2/ChangeLog @@ -1,3 +1,9 @@ +2025-07-01 Gaius Mulley <gaiusmod2@gmail.com> + + PR modula2/120912 + * gm2-libs-iso/IOChanUtils.def (GetFile): New procedure function. + * gm2-libs-iso/IOChanUtils.mod (GetFile): New procedure function. + 2025-06-29 Gaius Mulley <gaiusmod2@gmail.com> PR modula2/117203 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1e78e86..ab15e88 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,146 @@ +2025-07-02 Dimitar Dimitrov <dimitar@dinux.eu> + + * gcc.target/riscv/mcpu-xt-c908.c: Disable for E ABI variants. + * gcc.target/riscv/mcpu-xt-c908v.c: Ditto. + * gcc.target/riscv/mcpu-xt-c910.c: Ditto. + * gcc.target/riscv/mcpu-xt-c910v2.c: Ditto. + * gcc.target/riscv/mcpu-xt-c920.c: Ditto. + * gcc.target/riscv/mcpu-xt-c920v2.c: Ditto. + * gcc.target/riscv/pr118241.c: Ditto. + * gcc.target/riscv/pr120223.c: Ditto. + * gcc.target/riscv/rvv/base/pr119164.c: Disable for E ABI variants + and for 32-bit ISA. + +2025-07-02 Alexey Merzlyakov <alexey.merzlyakov@samsung.com> + + PR target/120356 + * gcc.target/riscv/rvv/autovec/pr120356.c: New test. + +2025-07-01 Qing Zhao <qing.zhao@oracle.com> + + * gcc.dg/ubsan/pointer-counted-by-bounds-2.c: New test. + * gcc.dg/ubsan/pointer-counted-by-bounds-3.c: New test. + * gcc.dg/ubsan/pointer-counted-by-bounds-4.c: New test. + * gcc.dg/ubsan/pointer-counted-by-bounds-5.c: New test. + * gcc.dg/ubsan/pointer-counted-by-bounds.c: New test. + +2025-07-01 Qing Zhao <qing.zhao@oracle.com> + + * gcc.dg/pointer-counted-by-4-char.c: New test. + * gcc.dg/pointer-counted-by-4-float.c: New test. + * gcc.dg/pointer-counted-by-4-struct.c: New test. + * gcc.dg/pointer-counted-by-4-union.c: New test. + * gcc.dg/pointer-counted-by-4.c: New test. + * gcc.dg/pointer-counted-by-5.c: New test. + * gcc.dg/pointer-counted-by-6.c: New test. + * gcc.dg/pointer-counted-by-7.c: New test. + +2025-07-01 Qing Zhao <qing.zhao@oracle.com> + + * gcc.dg/flex-array-counted-by.c: Update test. + * gcc.dg/pointer-counted-by-1.c: New test. + * gcc.dg/pointer-counted-by-2.c: New test. + * gcc.dg/pointer-counted-by-3.c: New test. + * gcc.dg/pointer-counted-by.c: New test. + +2025-07-01 Jakub Jelinek <jakub@redhat.com> + + PR testsuite/120919 + * gcc.target/powerpc/builtin_altivec_tr_stxvr_runnable.c (main): Change + sc, ss, si and sll vars from scalars to arrays of 2 elements, + initialize and test just the first one though. + +2025-07-01 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/specs/finalizable2.ads: New test. + +2025-07-01 Jakub Jelinek <jakub@redhat.com> + + * gcc.target/s390/vector/vec-abs-emu.c: Add -fno-stack-protector + to dg-options. + * gcc.target/s390/vector/vec-max-emu.c: Likewise. + * gcc.target/s390/vector/vec-min-emu.c: Likewise. + +2025-07-01 Robert Dubner <rdubner@symas.com> + + * cobol.dg/group2/Intrinsics_without_FUNCTION_keyword__2_.cob: + Append INTRINSIC keyword. + +2025-07-01 Jakub Jelinek <jakub@redhat.com> + + PR c++/120471 + * g++.dg/ubsan/pr120471.C: New test. + * g++.dg/parse/pr120471.C: New test. + +2025-07-01 Remi Machet <rmachet@nvidia.com> + + * gcc.target/aarch64/simd/shrn2subhn.c: New test. + +2025-07-01 Andre Vehreschild <vehre@gcc.gnu.org> + + PR fortran/120847 + * gfortran.dg/coarray/coindexed_7.f90: New test. + +2025-07-01 Jakub Jelinek <jakub@redhat.com> + + PR ipa/119318 + PR testsuite/120082 + * gcc.dg/ipa/pr119318.c (main): Expect different result on big endian + from little endian, on unexpected endianness or int/int128 sizes don't + test anything. Formatting fixes. + +2025-07-01 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + * gcc.target/i386/preserve-none-1.c (dg-options): Add + -fomit-frame-pointer. + +2025-07-01 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + * g++.target/i386/memset-pr101366-1.C (dg-options): Add + -fasynchronous-unwind-tables -fdwarf2-cfi-asm. + * g++.target/i386/memset-pr101366-2.C: Likewise. + * g++.target/i386/memset-pr118276-1a.C: Likewise. + * g++.target/i386/memset-pr118276-1b.C: Likewise. + * g++.target/i386/memset-pr118276-1c.C: Likewise. + * gcc.target/i386/memset-pr70308-1a.c: Likewise. + * gcc.target/i386/memset-strategy-25.c: Likewise. + * gcc.target/i386/memset-strategy-28.c: Likewise. + * gcc.target/i386/memset-strategy-29.c: Likewise. + * gcc.target/i386/memset-strategy-30.c: Likewise. + * gcc.target/i386/pr92080-17.c: Likewise. + * gcc.target/i386/memset-pr70308-1b.c: Likewise. Also add + -fomit-frame-pointer. + * g++.target/i386/memset-pr108585-1a.C: (dg-options): Add + -fasynchronous-unwind-tables -fdwarf2-cfi-asm. Also add + -mno-stackrealign -fomit-frame-pointer. + * g++.target/i386/memset-pr108585-1b.C: Likewise. + +2025-07-01 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/120608 + * c-c++-common/asan/pr120608-3.c: New test. + * c-c++-common/asan/pr120608-4.c: New test. + * g++.dg/asan/pr120608-3.C: New test. + * g++.dg/asan/pr120608-4.C: New test. + +2025-07-01 Andre Vehreschild <vehre@gcc.gnu.org> + + PR fortran/120843 + * gfortran.dg/coarray/coindexed_6.f90: New test. + +2025-07-01 Yuao Ma <c8ef@outlook.com> + + * lib/target-supports.exp (foldable_pi_based_trigonometry): New + effective target. + * gcc.dg/torture/builtin-math-9.c: New test. + +2025-07-01 Alexandre Oliva <oliva@adacore.com> + + PR middle-end/120631 + * gcc.dg/dfp/pr120631.c: Drop overrider of dg-do default action. + * gcc.dg/dfp/bitint-9.c: Likewise. + * gcc.dg/dfp/bitint-10.c: Likewise. + 2025-06-30 Jeff Law <jlaw@ventanamicro.com> PR rtl-optimization/120242 diff --git a/gcc/testsuite/gcc.dg/ubsan/pointer-counted-by-bounds-2.c b/gcc/testsuite/gcc.dg/ubsan/pointer-counted-by-bounds-2.c new file mode 100644 index 0000000..0653ecc --- /dev/null +++ b/gcc/testsuite/gcc.dg/ubsan/pointer-counted-by-bounds-2.c @@ -0,0 +1,51 @@ +/* Test the attribute counted_by for pointer fields and its usage in + bounds sanitizer combined with VLA. */ +/* { dg-do run } */ +/* { dg-options "-fsanitize=bounds" } */ +/* { dg-output "index 11 out of bounds for type 'int \\\[\\\*\\\]\\\[\\\*\\\]'\[^\n\r]*(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*index 20 out of bounds for type 'int \\\[\\\*\\\]\\\[\\\*\\\]\\\[\\\*\\\]'\[^\n\r]*(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*index 11 out of bounds for type 'int \\\[\\\*\\\]\\\[\\\*\\\]'\[^\n\r]*(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*index 10 out of bounds for type 'int \\\[\\\*\\\]'\[^\n\r]*(\n|\r\n|\r)" } */ + + +#include <stdlib.h> + +void __attribute__((__noinline__)) setup_and_test_vla (int n, int m) +{ + struct foo { + int n; + int (*p)[n] __attribute__((counted_by(n))); + } *f; + + f = (struct foo *) malloc (sizeof (struct foo)); + f->p = (int (*)[n]) malloc (m * sizeof (int[n])); + f->n = m; + f->p[m][n-1] = 1; + free (f->p); + free (f); + return; +} + +void __attribute__((__noinline__)) setup_and_test_vla_1 (int n1, int n2, int m) +{ + struct foo { + int n; + int (*p)[n2][n1] __attribute__((counted_by(n))); + } *f; + + f = (struct foo *) malloc (sizeof(struct foo)); + f->p = (int (*)[n2][n1]) malloc (m * sizeof (int[n2][n1])); + f->n = m; + f->p[m][n2][n1] = 1; + free (f->p); + free (f); + return; +} + +int main(int argc, char *argv[]) +{ + setup_and_test_vla (10, 11); + setup_and_test_vla_1 (10, 11, 20); + return 0; +} + diff --git a/gcc/testsuite/gcc.dg/ubsan/pointer-counted-by-bounds-3.c b/gcc/testsuite/gcc.dg/ubsan/pointer-counted-by-bounds-3.c new file mode 100644 index 0000000..731422d --- /dev/null +++ b/gcc/testsuite/gcc.dg/ubsan/pointer-counted-by-bounds-3.c @@ -0,0 +1,42 @@ +/* Test the attribute counted_by for pointer fields and its usage in bounds + sanitizer. when counted_by field is negative value. */ +/* { dg-do run } */ +/* { dg-options "-fsanitize=bounds" } */ + +#include <stdlib.h> + +struct annotated { + int b; + int *c __attribute__ ((counted_by (b))); +} *array_annotated; + +void __attribute__((__noinline__)) setup (int annotated_count) +{ + array_annotated + = (struct annotated *)malloc (sizeof (struct annotated)); + array_annotated->c = (int *) malloc (sizeof (int) * 10); + array_annotated->b = annotated_count; + + return; +} + +void __attribute__((__noinline__)) test (int annotated_index) +{ + array_annotated->c[annotated_index] = 2; +} + +void cleanup () +{ + free (array_annotated->c); + free (array_annotated); +} + +int main(int argc, char *argv[]) +{ + setup (-3); + test (2); + cleanup (); + return 0; +} + +/* { dg-output "25:21: runtime error: index 2 out of bounds for type" } */ diff --git a/gcc/testsuite/gcc.dg/ubsan/pointer-counted-by-bounds-4.c b/gcc/testsuite/gcc.dg/ubsan/pointer-counted-by-bounds-4.c new file mode 100644 index 0000000..52f202f --- /dev/null +++ b/gcc/testsuite/gcc.dg/ubsan/pointer-counted-by-bounds-4.c @@ -0,0 +1,42 @@ +/* Test the attribute counted_by for pointer fields and its usage in bounds + sanitizer. when counted_by field is zero value. */ +/* { dg-do run } */ +/* { dg-options "-fsanitize=bounds" } */ + +#include <stdlib.h> + +struct annotated { + int b; + int *c __attribute__ ((counted_by (b))); +} *array_annotated; + +void __attribute__((__noinline__)) setup (int annotated_count) +{ + array_annotated + = (struct annotated *)malloc (sizeof (struct annotated)); + array_annotated->c = (int *)malloc (sizeof (int) * 10); + array_annotated->b = annotated_count; + + return; +} + +void __attribute__((__noinline__)) test (int annotated_index) +{ + array_annotated->c[annotated_index] = 2; +} + +void cleanup () +{ + free (array_annotated->c); + free (array_annotated); +} + +int main(int argc, char *argv[]) +{ + setup (0); + test (1); + cleanup (); + return 0; +} + +/* { dg-output "25:21: runtime error: index 1 out of bounds for type" } */ diff --git a/gcc/testsuite/gcc.dg/ubsan/pointer-counted-by-bounds-5.c b/gcc/testsuite/gcc.dg/ubsan/pointer-counted-by-bounds-5.c new file mode 100644 index 0000000..8ad7572 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ubsan/pointer-counted-by-bounds-5.c @@ -0,0 +1,40 @@ +/* Test the attribute counted_by for pointer fields and its usage in + bounds sanitizer. */ +/* { dg-do run } */ +/* { dg-options "-fsanitize=bounds" } */ + +#include <stdlib.h> + +struct annotated { + int b; + int *c __attribute__ ((counted_by (b))); +} *p_array_annotated; + +void __attribute__((__noinline__)) setup (int annotated_count) +{ + p_array_annotated + = (struct annotated *)malloc (sizeof (struct annotated)); + p_array_annotated->c = (int *) malloc (annotated_count * sizeof (int)); + p_array_annotated->b = annotated_count; + + return; +} + +void cleanup () +{ + free (p_array_annotated->c); + free (p_array_annotated); +} + +int main(int argc, char *argv[]) +{ + int i; + setup (10); + for (i = 0; i < 11; i++) + p_array_annotated->c[i] = 2; // goes boom at i == 10 + cleanup (); + return 0; +} + + +/* { dg-output "34:25: runtime error: index 10 out of bounds for type" } */ diff --git a/gcc/testsuite/gcc.dg/ubsan/pointer-counted-by-bounds.c b/gcc/testsuite/gcc.dg/ubsan/pointer-counted-by-bounds.c new file mode 100644 index 0000000..c5a1ac5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ubsan/pointer-counted-by-bounds.c @@ -0,0 +1,46 @@ +/* Test the attribute counted_by for pointer fields and its usage in + bounds sanitizer. */ +/* { dg-do run } */ +/* { dg-options "-fsanitize=bounds" } */ + +#include <stdlib.h> + +struct pointer_array { + int b; + int *c; +} *p_array; + +struct annotated { + int b; + int *c __attribute__ ((counted_by (b))); +} *p_array_annotated; + +void __attribute__((__noinline__)) setup (int normal_count, int annotated_count) +{ + p_array + = (struct pointer_array *) malloc (sizeof (struct pointer_array)); + p_array->c = (int *) malloc (normal_count * sizeof (int)); + p_array->b = normal_count; + + p_array_annotated + = (struct annotated *) malloc (sizeof (struct annotated)); + p_array_annotated->c = (int *) malloc (annotated_count * sizeof (int)); + p_array_annotated->b = annotated_count; + + return; +} + +void __attribute__((__noinline__)) test (int normal_index, int annotated_index) +{ + p_array->c[normal_index] = 1; + p_array_annotated->c[annotated_index] = 2; +} + +int main(int argc, char *argv[]) +{ + setup (10, 10); + test (10, 10); + return 0; +} + +/* { dg-output "36:23: runtime error: index 10 out of bounds for type" } */ diff --git a/gcc/testsuite/gcc.target/riscv/mcpu-xt-c908.c b/gcc/testsuite/gcc.target/riscv/mcpu-xt-c908.c index cb28baf..4ad82a8 100644 --- a/gcc/testsuite/gcc.target/riscv/mcpu-xt-c908.c +++ b/gcc/testsuite/gcc.target/riscv/mcpu-xt-c908.c @@ -1,4 +1,4 @@ -/* { dg-do compile } */ +/* { dg-do compile { target { ! riscv_abi_e } } } */ /* { dg-skip-if "-march given" { *-*-* } { "-march=*" } } */ /* { dg-options "-mcpu=xt-c908" { target { rv64 } } } */ /* XuanTie C908 => rv64imafdc_zicbom_zicbop_zicboz_zicntr_zicsr_zifencei_ diff --git a/gcc/testsuite/gcc.target/riscv/mcpu-xt-c908v.c b/gcc/testsuite/gcc.target/riscv/mcpu-xt-c908v.c index 1b1ee18..bb9e310 100644 --- a/gcc/testsuite/gcc.target/riscv/mcpu-xt-c908v.c +++ b/gcc/testsuite/gcc.target/riscv/mcpu-xt-c908v.c @@ -1,4 +1,4 @@ -/* { dg-do compile } */ +/* { dg-do compile { target { ! riscv_abi_e } } } */ /* { dg-skip-if "-march given" { *-*-* } { "-march=*" } } */ /* { dg-options "-mcpu=xt-c908v" { target { rv64 } } } */ /* XuanTie C908v => rv64imafdcv_zicbom_zicbop_zicboz_zicntr_zicsr_zifencei_ diff --git a/gcc/testsuite/gcc.target/riscv/mcpu-xt-c910.c b/gcc/testsuite/gcc.target/riscv/mcpu-xt-c910.c index 1e27665..397e7b1 100644 --- a/gcc/testsuite/gcc.target/riscv/mcpu-xt-c910.c +++ b/gcc/testsuite/gcc.target/riscv/mcpu-xt-c910.c @@ -1,4 +1,4 @@ -/* { dg-do compile } */ +/* { dg-do compile { target { ! riscv_abi_e } } } */ /* { dg-skip-if "-march given" { *-*-* } { "-march=*" } } */ /* { dg-options "-mcpu=xt-c910" { target { rv64 } } } */ /* XuanTie C910 => rv64imafdc_zicntr_zicsr_zifencei_zihpm_zfh_xtheadba_ diff --git a/gcc/testsuite/gcc.target/riscv/mcpu-xt-c910v2.c b/gcc/testsuite/gcc.target/riscv/mcpu-xt-c910v2.c index 6a54f09..9e39c9f 100644 --- a/gcc/testsuite/gcc.target/riscv/mcpu-xt-c910v2.c +++ b/gcc/testsuite/gcc.target/riscv/mcpu-xt-c910v2.c @@ -1,4 +1,4 @@ -/* { dg-do compile } */ +/* { dg-do compile { target { ! riscv_abi_e } } } */ /* { dg-skip-if "-march given" { *-*-* } { "-march=*" } } */ /* { dg-options "-mcpu=xt-c910v2" { target { rv64 } } } */ /* XuanTie C910v2 => rv64imafdc_zicbom_zicbop_zicboz_zicntr_zicond_zicsr_ diff --git a/gcc/testsuite/gcc.target/riscv/mcpu-xt-c920.c b/gcc/testsuite/gcc.target/riscv/mcpu-xt-c920.c index 6bcd687..4cce90a 100644 --- a/gcc/testsuite/gcc.target/riscv/mcpu-xt-c920.c +++ b/gcc/testsuite/gcc.target/riscv/mcpu-xt-c920.c @@ -1,4 +1,4 @@ -/* { dg-do compile } */ +/* { dg-do compile { target { ! riscv_abi_e } } } */ /* { dg-skip-if "-march given" { *-*-* } { "-march=*" } } */ /* { dg-options "-mcpu=xt-c920" { target { rv64 } } } */ /* XuanTie c920 => rv64imafdc_zicntr_zicsr_zifencei_zihpm_zfh_"xtheadba_xtheadbb_xtheadbs_xtheadcmo_xtheadcondmov_xtheadfmemidx_xtheadmac_xtheadmemidx_xtheadmempair_xtheadsync_xtheadvector */ diff --git a/gcc/testsuite/gcc.target/riscv/mcpu-xt-c920v2.c b/gcc/testsuite/gcc.target/riscv/mcpu-xt-c920v2.c index 36a6267..1f21d07 100644 --- a/gcc/testsuite/gcc.target/riscv/mcpu-xt-c920v2.c +++ b/gcc/testsuite/gcc.target/riscv/mcpu-xt-c920v2.c @@ -1,4 +1,4 @@ -/* { dg-do compile } */ +/* { dg-do compile { target { ! riscv_abi_e } } } */ /* { dg-skip-if "-march given" { *-*-* } { "-march=*" } } */ /* { dg-options "-mcpu=xt-c920v2" { target { rv64 } } } */ /* XuanTie C920v2 => rv64imafdcv_zicbom_zicbop_zicboz_zicntr_zicond_zicsr_zifencei _zihintntl_zihintpause_zihpm_zawrs_zfa_zfbfmin_zfh_zca_zcb_zcd_zba_zbb_zbc_zbs_zvfbfmin_zvfbfwma_zvfh_sscofpmf_sstc_svinval_svnapot_svpbmt_xtheadba_xtheadbb_xtheadbs_xtheadcmo_xtheadcondmov_xtheadfmemidx_xtheadsync_xtheadvdot */ diff --git a/gcc/testsuite/gcc.target/riscv/pr118241.c b/gcc/testsuite/gcc.target/riscv/pr118241.c index f1dc44b..768ea05 100644 --- a/gcc/testsuite/gcc.target/riscv/pr118241.c +++ b/gcc/testsuite/gcc.target/riscv/pr118241.c @@ -1,4 +1,4 @@ -/* { dg-do compile } */ +/* { dg-do compile { target { ! riscv_abi_e } } } */ /* { dg-options "-march=rv64gc_zicbop" { target { rv64 } } } */ /* { dg-options "-march=rv32gc_zicbop" { target { rv32 } } } */ /* { dg-skip-if "" { *-*-* } { "-O0" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/pr120223.c b/gcc/testsuite/gcc.target/riscv/pr120223.c index fae21b6..d6afd86 100644 --- a/gcc/testsuite/gcc.target/riscv/pr120223.c +++ b/gcc/testsuite/gcc.target/riscv/pr120223.c @@ -1,4 +1,4 @@ -/* { dg-do compile } */ +/* { dg-do compile { target { ! riscv_abi_e } } } */ /* { dg-options "-mcpu=thead-c906" } */ long foo(long x) { return x ^ 0x80000000; } diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr120356.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr120356.c new file mode 100644 index 0000000..2913f04 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr120356.c @@ -0,0 +1,26 @@ +/* { dg-do run } */ +/* { dg-require-effective-target rvv_zvl256b_ok } */ +/* { dg-options "-march=rv64gcv_zvl256b -mabi=lp64d -mrvv-vector-bits=zvl -O2" } */ + +unsigned char a = 5; +long long c[18]; + +static void d () +{ + for (short i = 0; i < 60; i += 65413) + for (char j = 0; j < 18; j++) + { + for (char k = 0; k < 18; k++) + a *= 143; + for (char k = 0; k < 6; k++) + for (char l = 0; l < 18; l++) + c[l] = 0; + } +} + +int main () +{ + d (); + if (a + c[0] != 69) + __builtin_abort (); +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr119164.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr119164.c index a39a7f1..266e948 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/pr119164.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr119164.c @@ -1,7 +1,7 @@ /* Reduced from SPEC2017 blender: node_texture_util.c. The conditional function call was tripping mode switching state machine */ -/* { dg-do compile } */ +/* { dg-do compile { target { rv64 && { ! riscv_abi_e } } } } */ /* { dg-options " -Ofast -march=rv64gcv_zvl256b -ftree-vectorize -mrvv-vector-bits=zvl" } */ void *a; diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index 575987e..2782d61 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -3792,6 +3792,7 @@ vect_analyze_loop (class loop *loop, gimple *loop_vectorized_call, /* When we selected a first vectorized epilogue, see if the target suggests to have another one. */ if (!unlimited_cost_model (loop) + && !LOOP_VINFO_USING_PARTIAL_VECTORS_P (orig_loop_vinfo) && (orig_loop_vinfo->vector_costs->suggested_epilogue_mode () != VOIDmode)) { |