aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2025-06-10ada: Storage_Error on Ordered_Maps container aggregate with enumeration Key_TypeGary Dismukes1-1/+1
The compiler fails with a Storage_Error when compiling a container aggregate for a Map type coming from an instantiation of Ada.Containers.Ordered_Maps that specifies an enumeration type for the Key_Type formal. gcc/ada/ChangeLog: * exp_aggr.adb (Build_Container_Aggr_Code.To_Int): Apply Enumeration_Pos to Entity (Expr) rather than Expr.
2025-06-10ada: Fix infinite loop with aggregate in generic unitEric Botcazou1-4/+1
Root_Type does not return the same type for the private and the full view of a derived private tagged type when both derive from an interface type. gcc/ada/ChangeLog: * sem_ch12.adb (Copy_Generic_Node): Do not call Root_Type to find the root type of an aggregate of a derived tagged type.
2025-06-10ada: Fix use-after-free in Compute_All_TasksRonan Desplanques1-1/+4
This patch fixes a bug in System.Stack_Usage.Tasking.Compute_All_Tasks where it would attempt to read the stack of threads that had already completed. gcc/ada/ChangeLog: * libgnarl/s-stusta.adb (Compute_All_Tasks): Skip terminated tasks.
2025-06-10ext-dce: Don't refine live width with SUBREG mode if ↵Xi Ruoyao1-2/+15
!TRULY_NOOP_TRUNCATION_MODES_P [PR 120050] If we see a promoted subreg and TRULY_NOOP_TRUNCATION says the truncation is not a noop, then all bits of the inner reg are live. We cannot reduce the live mask to that of the mode of the subreg. gcc/ChangeLog: PR rtl-optimization/120050 * ext-dce.cc (ext_dce_process_uses): Break early if a SUBREG in rhs is promoted and the truncation from the inner mode to the outer mode is not a noop when handling SETs. (cherry picked from commit 65f3a439c4f76fe780a30ac66969f51035c4bf98)
2025-06-10Daily bump.GCC Administrator4-1/+81
2025-06-09c++: recursive template with deduced return [PR120555]Jason Merrill2-3/+60
Here since r15-4120 we were prematurely complaining about the use of func within its own definiton, which is fine at instantiation time. So don't require this for function templates that are currently being defined. But keep the error for instantiations of templates that are not currently being defined, which we similarly did not diagnose before r15-4120 but other implementations do. Both of these follow the general principle from [temp.res.general]/6 that we only error in a template body if no instatiation could be well-formed. Also remove a redundant call to require_deduced_type. PR c++/120555 gcc/cp/ChangeLog: * decl2.cc (fn_being_defined, fn_template_being_defined): New. (mark_used): Check fn_template_being_defined. gcc/testsuite/ChangeLog: * g++.dg/cpp1z/constexpr-if39.C: New test. (cherry picked from commit 8d204f2a536f7253e4251aca7bc12af524800b4c)
2025-06-09c++: constexpr prvalues vs genericize [PR120502]Jason Merrill3-9/+41
Here constexpr evaluation was getting confused by the result of split_nonconstant_init, which leaves an INIT_EXPR from an empty CONSTRUCTOR to be followed by member initialization. As a result CONSTRUCTOR_NO_CLEARING was set for the time_zone, and cxx_eval_store_expression didn't set it again for the initial clobber in the basic_string constructor, so when cxx_fold_indirect_ref wants to check whether the anonymous union active member had type non_trivial_if, we see that we don't currently have a value for the anonymous union, try to add one, and fail. So let's do constexpr evaluation before split_nonconstant_init. PR c++/120502 gcc/cp/ChangeLog: * cp-gimplify.cc (cp_fold_r) [TARGET_EXPR]: Do constexpr evaluation before genericize. * constexpr.cc (cxx_eval_store_expression): Add comment. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/constexpr-prvalue2.C: New test.
2025-06-09ada: Support fixed-lower-bound array types as generic actual parametersGary Dismukes2-1/+13
Attempting to use a fixed-lower-bound array type (or subtype) as an actual parameter for a formal unconstrained array type was being rejected by the compiler (complaining about the index type of the actual not matching the index type of the formal type). The compiler was improperly testing the actual's FLB range and finding that it didn't statically match the index type of the formal array type; it should instead test the underlying index type of the FLB type or subtype. gcc/ada/ChangeLog: * sem_ch3.adb (Constrain_Index): In the case of a fixed-lower-bound index, set Etype of the newly created itype's Scalar_Range from the index's Etype. * sem_ch12.adb (Validate_Array_Type_Instance): If the actual subtype is a fixed-lower-bound type, then check again the Etype of its Scalar_Range.
2025-06-09ada: Reject component-related aspects on formal non-array typesPiotr Trojanek1-7/+4
In Ada 2022 aspects Atomic_Components and Volatile_Components can be specified for a formal array type, but they were wrongly accepted on any formal type. Also, we don't need to check if the corresponding pragmas appear in Ada 2022 mode, because generic formal parameters can't have explicit representation pragmas in any Ada version and can only have aspects since Ada 2022. gcc/ada/ChangeLog: * sem_prag.adb (Analyze_Pragma): Fix conditions for legality checks on formal type declarations.
2025-06-09ada: Fix glitch in handling of Atomic_Components on generic formal typePiotr Trojanek1-1/+3
In Ada 2022 aspects Atomic_Components and Volatile_Components can be specified for a formal array type, but then they need to be set on the base type entity. Otherwise we get an assertion failure in debug build and wrong legality errors in production builds. gcc/ada/ChangeLog: * sem_prag.adb (Analyze_Pragma): If pragmas apply to a formal array type, then set the flags on the base type.
2025-06-09ada: Missing discriminant check on assignment of Bounded_Vector aggregateGary Dismukes1-1/+10
When a container aggregate for a Bounded_Vector type involves an iterated association that is assigned to a vector object whose capacity (as defined by the Capacity discriminant) is less than the number of elements of the aggregate, Constraint_Error should be raised due to failing a discriminant check on the assignment. But the compiler fails to do proper expansion, plus omits the check, and instead creates a temporary whose capacity is bounded by that of the target vector of the assignment. It attempts to assign all elements of the aggregate to the temporary, resulting in a failure on a call to the Replace_Element operation that assigns past the length of the temporary vector (which can result in a Storage_Error due to a segment violation). This is fixed by ensuring that the temporary object is declared with an unconstrained base subtype rather than the assignment target's constrained subtype. gcc/ada/ChangeLog: * exp_aggr.adb (Expand_Container_Aggregate): Use the Base_Type of the subtype provided by the context as the subtype of the temporary object initialized by the aggregate.
2025-06-09ada: Check validity using signedness from the type and not its base typePiotr Trojanek1-3/+2
When attribute Valid is applied to a private type, we used the signedness of its implementation base type which wrongly included negative values. gcc/ada/ChangeLog: * exp_attr.adb (Expand_N_Attribute_Reference): When expanding attribute Valid, use signedness from the validated view, not from its base type.
2025-06-09ada: Incorrect creation of corresponding expression of class-wide contractsGary Dismukes2-95/+121
GNAT was incorrectly implementing the Ada rules for resolving calls to primitive functions within inherited class-wide pre- and postconditions, as specified in RM22 6.1.1 (relating to AI12-0113). Only function calls that involve formals of the associated primitive subprogram should be treated using the "(notional) formal derived type" rules. In particular, calls that are tag-indeterminate (for example, "F(G)") should not be mapped to call the corresponding primitives of the derived type (they should still call the primitives of the ancestor type). The fix for this involves a new predicate function that recursively traverses calls to determine the calls that satisfy the criteria for mapping. These changes also completely remove the mapping of formals that was done in Contracts.Merge_Class_Conditions (in Inherit_Condition), since the mapping will be done later anyway by Build_Class_Wide_Expression, and the earlier mapping interferes with that. Note: The utility function Sem_Util.Check_Parents is no longer called after removal of the single call to it from contracts.adb, but it's being retained (along with the generic subprograms in Atree that it depends on) for possible use in VAST. gcc/ada/ChangeLog: * contracts.adb (Inherit_Condition): Remove Assoc_List and its uses along with function Check_Condition, since mapping of formals will effectively be done in Build_Class_Wide_Expression (by Replace_Entity). * exp_util.adb (Replace_Entity): Only rewrite entity references in function calls that qualify according to the result of calling the new function Call_To_Parent_Dispatching_Op_Must_Be_Mapped. (Call_To_Parent_Dispatching_Op_Must_Be_Mapped): New function that determines whether a function call to a primitive of Par_Subp associated tagged type needs to be mapped (according to whether it has any actuals that reference controlling formals of the primitive).
2025-06-09ada: Fix spurious error on anonymous array initialized by conditional expressionEric Botcazou1-22/+21
Even though the actual subtype of the anonymous array is not yet set on the object itself by the time Insert_Conditional_Object_Declaration is called, it is set on its initialization expression, so it can simply be forwarded to Insert_Conditional_Object_Declaration from there, which avoids creating a new one for each new object and triggering a subtype mismatch later. gcc/ada/ChangeLog: * exp_ch4.adb (Insert_Conditional_Object_Declaration): Remove Decl formal parameter, add Typ and Const formal parameters. (Expand_N_Case_Expression): Fix pasto in comment. Adjust call to Insert_Conditional_Object_Declaration and tidy up surrounding code. (Expand_N_If_Expression): Adjust couple of calls to Insert_Conditional_Object_Declaration.
2025-06-09Daily bump.GCC Administrator1-1/+1
2025-06-08Daily bump.GCC Administrator1-1/+1
2025-06-07Daily bump.GCC Administrator5-1/+238
2025-06-06ChangeLog.omp bumpTobias Burnus5-1/+63
2025-06-06ada: Constant_Indexing used when context requires a variableJavier Miranda1-219/+667
In the case of an assignment where the type of its left hand side is an indexable container that has indexable container components (for example a container vector of container vectors), and both indexable containers have Constant_Indexing and Variable_Indexing aspects, the left hand side of the assignment is erroneously interpreted as constant indexing. The error results in spurious compile-time error messages saying that the left hand side of the assignment must be a variable. gcc/ada/ChangeLog: * sem_ch4.adb (Constant_Indexing_OK): Add missing support for RM 4.1.6(13/3), and improve performance to avoid climbing more than needed. Add documentation. (Try_Indexing_Function): New subprogram. (Expr_Matches_In_Formal): Added new formals. (Handle_Selected_Component): New subprogram. (Has_IN_Mode): New subprogram. (Try_Container_Indexing): Add documentation, code reorganization and extend its functionality to improve its support for prefixed notation calls.
2025-06-06ada: Fix libgpr2 build failure with compiler built with assertionsEric Botcazou1-0/+2
The problem is that the Entity field is accessed for a node without one. gcc/ada/ChangeLog: * sem_ch10.adb (Install_Siblings.In_Context): Add missing guard.
2025-06-06ada: Fix wrong initialization of library-level object by conditional expressionEric Botcazou1-1/+8
At library level the object must be allocated statically and with its bounds when its nominal subtype is an unconstrained array type. gcc/ada/ChangeLog: * exp_ch4.adb (Insert_Conditional_Object_Declaration): Make sure the object is allocated properly by the code generator at library level.
2025-06-06ada: Incorrect unresolved operator name in an instantiationSteve Baird1-23/+2
In some cases, a generic containing a use of a unary operator successfully compiles but the compiler incorrectly rejects the corresponding use in an instantiation. gcc/ada/ChangeLog: * sem_ch4.adb (Find_Unary_Types): Because we reanalyze names in an instance, we sometimes have to take steps to filter out extraneous name resolution candidates that happen to be visible at the point of the instance declaration. Remove some code that appears to have been written with this in mind. This is done for two reasons. First, the code sometimes doesn't work (possibly because the In_Instance test is not specific enough - it probably should be testing to see whether we are in an instance of the particular generic in which the result of calling Corresponding_Generic_Type was declared) and causes correct code to be rejected. Second, the code seems to no longer be necessary (possibly because of subsequent fixes in this area which are not specific to unary operators).
2025-06-06ada: Fix internal error on allocator involving interface typeEric Botcazou5-33/+51
The problem is that an itype duplicated through Duplicate_Subexpr_No_Checks ends up in a different scope than its source. It is fixed by adding a new formal parameter New_Scope to the function and forwarding it in the call to the New_Copy_Tree function. gcc/ada/ChangeLog: * exp_aggr.adb (Expand_Record_Aggregate): Use the named form for the second actual parameter in the call to Duplicate_Subexpr. * exp_attr.adb (Expand_Size_Attribute): Likewise. * exp_ch5.adb (Expand_Assign_Array): Likewise. (Expand_Assign_Array_Bitfield): Likewise. (Expand_Assign_Array_Bitfield_Fast): Likewise. * exp_util.ads (Duplicate_Subexpr): Add New_Scope formal parameter. (Duplicate_Subexpr_No_Checks): Likewise. (Duplicate_Subexpr_Move_Checks): Likewise. * exp_util.adb (Build_Allocate_Deallocate_Proc): Pass Proc_Id as the actual for New_Scope in the calls to Duplicate_Subexpr_No_Checks. (Duplicate_Subexpr): Add New_Scope formal parameter and forward it in the call to New_Copy_Tree. (Duplicate_Subexpr_No_Checks): Likewise. (Duplicate_Subexpr_Move_Checks): Likewise.
2025-06-06ada: Fix for validity checking of limited scalar typesPiotr Trojanek1-3/+12
With a recent change we are now validity checking objects of private scalar types, but need to handle private scalar types whose public view is limited. gcc/ada/ChangeLog: * checks.adb (Insert_Valid_Check): Set flag Assignment_OK in the object declaration inserted for the validity checks.
2025-06-06OpenMP: Add omp_get_initial_device/omp_get_num_devices builtinsTobias Burnus11-6/+186
By adding omp_get_initial_device and omp_get_num_devices builtins for C, C++, and Fortran, the following can be achieved: * By making them pure, multiple calls can be avoiding in some cases. * Some comparisons can be optimized at compile time. omp_get_initial_device will be converted to omp_get_num_devices for consistency; note that OpenMP 6 also permits omp_initial_device (== -1) as value. If GCC has not been configure for offloading, either intrinsic will leads to 0 - and on the offload side, -1 (= omp_initial_device) is returned for omp_initial_device. gcc/fortran/ChangeLog: * f95-lang.cc (ATTR_PURE_NOTHROW_LIST): Define. * trans-expr.cc (get_builtin_fn): Handle omp_get_num_devices and omp_get_intrinsic_device. * gfortran.h (gfc_option_t): Add disable_omp_... for them. * options.cc (gfc_handle_option): Handle them with -fno-builtin-. gcc/ChangeLog: * gimple-fold.cc (gimple_fold_builtin_omp_get_initial_device, gimple_fold_builtin_omp_get_num_devices): New. (gimple_fold_builtin): Call them. * omp-builtins.def (BUILT_IN_OMP_GET_INITIAL_DEVICE): Add (BUILT_IN_OMP_GET_NUM_DEVICES): Make uservisible + pure. libgomp/ChangeLog: * libgomp.texi (omp_get_num_devices, omp_get_intrinsic_device): Document builtin handling. gcc/testsuite/ChangeLog: * c-c++-common/gomp/omp_get_num_devices_initial_device-2.c: New test. * c-c++-common/gomp/omp_get_num_devices_initial_device.c: New test. * gfortran.dg/gomp/omp_get_num_devices_initial_device-2.f90: New test. * gfortran.dg/gomp/omp_get_num_devices_initial_device.f90: New test. Co-authored-by: Sandra Loosemore <sloosemore@baylibre.com> (cherry picked from commit 387209938d2c476a67966c6ddbdbf817626f24a2)
2025-06-06builtins.def: Enable OpenMP/OpenACC builtins also with -fno-nonansi-builtinsTobias Burnus1-1/+5
The flags -std=c.. and -std=c++.. imply -fno-nonansi-builtins, which disabled the OpenMP/OpenACC intrinsics - but -fopenmp/-fopenacc builtin use should be rather othogonal to the user's choice between -std=c... and -std=gnuc... gcc/ChangeLog: * builtins.def (DEF_GOACC_BUILTIN_COMPILER, DEF_GOMP_BUILTIN_COMPILER): Set NONANSI_P = false to enable those also with -fno-nonansi-builtins. (cherry picked from commit 214b5d66c54613463a96aa2c7202bc32f628dad6)
2025-06-06libgomp.c/target-map-zero-sized-3.c: Fix code for non-USM offload [PR120530]Tobias Burnus1-3/+4
A mapping clause was missing, causing the code to fail with offloading when a host pointer was not device accessible. libgomp/ChangeLog: PR target/120530 * testsuite/libgomp.c/target-map-zero-sized-3.c (main): Add missing map clause; remove unused variable. (cherry picked from commit 16c742e1079e838b920a1b215af17828da7c6365)
2025-06-06Merge branch 'releases/gcc-15' into devel/omp/gcc-15Tobias Burnus58-440/+1647
Merge up to r15-9790-ga69ab79c1abaa4 (June 6, 2025)
2025-06-06gcn: Update --with-arch= for newer archsTobias Burnus2-10/+12
Replace hard-coded list of supported devices by directly checking config/gcn/gcn-devices.def. gcc/ChangeLog: * config.gcc (--with-{arch,tune}): Use .def file to validate gcn processor names. * doc/install.texi (amdgcn*-*-*): Update list of devices supported by --with-arch/--with-tune. (cherry picked from commit 61a6430cf663e3c980c2ee966f094fea7d99f8e7)
2025-06-06libstdc++: Fix flat_map::operator[] for const lvalue keys [PR120432]Patrick Palka2-3/+13
The const lvalue operator[] overload wasn't properly forwarding the key type to the generic overload, causing a hard error for const keys. Rather than correcting the forwarded type this patch just makes the non-template overloads call try_emplace directly instead. That way we can remove the non-standard same_as constraint on the generic overload and match the spec more closely. PR libstdc++/120432 libstdc++-v3/ChangeLog: * include/std/flat_map (flat_map::operator[]): Make the non-template overloads call try_emplace directly. Remove non-standard same_as constraint on the template overload. * testsuite/23_containers/flat_map/1.cc (test08): New test. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com> Reviewed-by: Jonathan Wakely <jwakely@redhat.com> (cherry picked from commit 91ed3248ce26aaaee4d7471aa4edbc07b3f1a90e)
2025-06-06libstdc++: Fix format call in formatting with empty specs for durations.Tomasz Kamiński1-1/+2
This patches fixes an obvious error, where the output iterator argument was missing for call to format_to, when duration with custom representation types are used. libstdc++-v3/ChangeLog: * include/bits/chrono_io.h (__formatter_chrono:_M_s): Add missing __out argument to format_to call. Reviewed-by: Jonathan Wakely <jwakely@redhat.com> Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com> (cherry picked from commit ac0a04b7a254fb8e1d8d7088336bcb4375807b1e)
2025-06-06tree-optimization/120357 - ICE with early break vectorizationRichard Biener2-1/+15
When doing early break vectorization of a loop with a conditional reduction the epilog creation code is confused as to before which exit to insert the conditional reduction induction IV update. The following make sure this is done before the main IV exit. PR tree-optimization/120357 * tree-vect-loop.cc (vect_create_epilog_for_reduction): Create the conditional reduction induction IV increment before the main IV exit. * gcc.dg/vect/vect-early-break_136-pr120357.c: New testcase. (cherry picked from commit dce4da51ab66c3abb84448326910cd42f6fe2499)
2025-06-06tree-optimization/120341 - stores into STRING_CSTs can trapRichard Biener4-3/+29
The following fixes conditional store elimination and store motion so they consider stores to STRING_CSTs as trapping. PR tree-optimization/120341 * tree-ssa-loop-im.cc (can_sm_ref_p): STRING_CSTs are readonly. * tree-ssa-phiopt.cc (cond_store_replacement): Likewise. * gcc.dg/torture/pr120341-1.c: New testcase. * gcc.dg/torture/pr120341-2.c: Likewise. (cherry picked from commit 02c58bc4b0885f5b6f50033da35768ebe6c4a030)
2025-06-06rtl-optimization/120182 - wrong-code with RTL DSE and constant addressesRichard Biener2-1/+46
RTL DSE forms store groups from unique invariant bases but that is confused when presented with constant addresses where it assigns one store group per unique address. That causes it to not consider 0x101:QI to alias 0x100:SI. Constant accesses can really alias to every object, in practice they appear for I/O and for access to objects fixed via linker scripts for example. So simply avoid registering a store group for them. PR rtl-optimization/120182 * dse.cc (canon_address): Constant addresses have no separate store group. * gcc.dg/torture/pr120182.c: New testcase. (cherry picked from commit b9434c3db900d5d037fdf2f64149b82800ceadf8)
2025-06-06Fix gcc.dg/tree-ssa/ssa-dom-thread-7.c for aarch64Richard Biener1-1/+1
So on another machine with a cross I see 17 jumps threaded, so adjusted like that. PR tree-optimization/120003 * gcc.dg/tree-ssa/ssa-dom-thread-7.c: Adjust aarch64 expected thread2 number of threads. (cherry picked from commit aa6f1df4ec46a20d2292291b192d3331e51b59f8)
2025-06-06tree-optimization/120003 - missed jump threadingRichard Biener3-7/+24
The following allows the entry and exit block of a jump thread path to be equal, which can easily happen when there isn't a forwarder on the interesting edge for an FSM thread conditional. We just don't want to enlarge the path from such a block. PR tree-optimization/120003 * tree-ssa-threadbackward.cc (back_threader::find_paths_to_names): Allow block re-use but do not enlarge the path beyond such a re-use. * gcc.dg/tree-ssa/ssa-thread-23.c: New testcase. * gcc.dg/tree-ssa/ssa-dom-thread-7.c: Adjust. (cherry picked from commit 1a13684dfc7286139064f7d7341462c9995cbd1c)
2025-06-06tree-optimization/119960 - failed external SLP promotionRichard Biener2-7/+71
The following addresses a too conservative sanity check of SLP nodes we want to promote external. The issue lies in code generation for such external which relies on get_later_stmt to figure an insert location. But get_later_stmt relies on the ability to totally order stmts, specifically implementation-wise that they are all from the same BB, which is what is verified at the moment. The patch changes this to require stmts to be orderable by dominance queries. For simplicity and seemingly enough for the testcase in PR119960, this handles the case of two distinct BBs. PR tree-optimization/119960 * tree-vect-slp.cc (vect_slp_can_convert_to_external): Handle cases where defs from multiple BBs are ordered by their dominance relation. * gcc.dg/vect/bb-slp-pr119960-1.c: New testcase. (cherry picked from commit cc74e2f2b39b6debbef1787a087abad2108e95dd)
2025-06-06tree-optimization/116352 - amend previous fixRichard Biener1-1/+10
The previous fix restricted external vector builds to defs from the same basic-block. That turns out too restrictive so we have to mitigate the original issue in a different way which is restricting it to the original case where all defs are in the same basic-block. PR tree-optimization/116352 * tree-vect-slp.cc (vect_build_slp_tree_2): When compressing operands from a two-operator node make sure the resulting operation does not mix defs from different basic-blocks. (cherry picked from commit 1e8bd720b1a618a39e2a41eec05e935c32d295f3)
2025-06-06tree-optimization/119960 - add validity checking to SLP schedulingRichard Biener1-8/+28
The following adds checks that when we search for a vector stmt insert location we arrive at one where all required operand defs are dominating the insert location. At the moment any such failure only blows up during SSA verification. There's the long-standing issue that we do not verify there exists a valid schedule of the SLP graph from BB vectorization into the existing CFG. We do not have the ability to insert vector stmts on the dominance frontier "end", nor to insert LC PHIs that would be eventually required. This should be done all differently, computing the schedule during analysis and failing if we can't schedule. PR tree-optimization/119960 * tree-vect-slp.cc (vect_schedule_slp_node): Sanity check dominance check on operand defs. (cherry picked from commit 5f44fcdfe18e72f2900d2757375843e88d32c535)
2025-06-06tree-optimization/119960 - fix and guard get_later_stmtRichard Biener1-3/+17
The following makes get_later_stmt handle stmts from different basic-blocks in the case they are orderd and otherwise asserts. * tree-vectorizer.h (get_later_stmt): Robustify against stmts in different BBs, assert when they are unordered. (cherry picked from commit a6cfde60d8c744b31b147022e797bbcc371ae092)
2025-06-06Fix regression from x86 multi-epilogue tuningRichard Biener6-7/+73
With the avx512_two_epilogues tuning enabled for zen4 and zen5 the gcc.target/i386/vect-epilogues-5.c testcase below regresses and ends up using AVX2 sized vectors for the masked epilogue rather than AVX512 sized vectors. The following patch rectifies this and adds coverage for the intended behavior. * config/i386/i386.cc (ix86_vector_costs::finish_cost): Do not suggest a first epilogue mode for AVX512 sized main loops with X86_TUNE_AVX512_TWO_EPILOGUES as that interferes with using a masked epilogue. * gcc.target/i386/vect-epilogues-1.c: New testcase. * gcc.target/i386/vect-epilogues-2.c: Likewise. * gcc.target/i386/vect-epilogues-3.c: Likewise. * gcc.target/i386/vect-epilogues-4.c: Likewise. * gcc.target/i386/vect-epilogues-5.c: Likewise. (cherry picked from commit 75c7f90bfe6fa8e6c1a70b784e98a3412861646d)
2025-06-06Daily bump.GCC Administrator4-1/+100
2025-06-05ChangeLog.omp bumpSandra Loosemore5-1/+44
2025-06-05OpenMP: Fix regressions in metadirective-target-device-2.c [PR120518]Sandra Loosemore1-4/+10
My previous patch that added a CLEANUP_POINT_EXPR around the device_num selector expression in the C++ front end broke the testcase c-c++-common/gomp/metadirective-target-device-2.c on offload targets. It confused the code in omp_device_num_check that tries to bypass error checking and do early resolution when the expression is a call to one of the OpenMP library functions. The solution is to make that code smart enough to look inside a CLEANUP_POINT_EXPR. gcc/ChangeLog PR c++/120518 * omp-general.cc (omp_device_num_check): Look inside a CLEANUP_POINT_EXPR when trying to optimize special cases. (cherry picked from commit 9788a1e24822226b55dd1ab521e34bfaf9f4974d)
2025-06-05OpenMP: Handle more cases in user/condition selectorSandra Loosemore11-19/+188
Tobias had noted that the C front end was not treating C23 constexprs as constant in the user/condition selector property, which led to missed opportunities to resolve metadirectives at parse time. Additionally neither C nor C++ was permitting the expression to have pointer or floating-point type -- the former being a common idiom in other C/C++ conditional expressions. By using the existing front-end hooks for the implicit conversion to bool in conditional expressions, we also get free support for using a C++ class object that has a bool conversion operator in the user/condition selector. gcc/c/ChangeLog * c-parser.cc (c_parser_omp_context_selector): Call convert_lvalue_to_rvalue and c_objc_common_truthvalue_conversion on the expression for OMP_TRAIT_PROPERTY_BOOL_EXPR. gcc/cp/ChangeLog * cp-tree.h (maybe_convert_cond): Declare. * parser.cc (cp_parser_omp_context_selector): Call maybe_convert_cond and fold_build_cleanup_point_expr on the expression for OMP_TRAIT_PROPERTY_BOOL_EXPR. * pt.cc (tsubst_omp_context_selector): Likewise. * semantics.cc (maybe_convert_cond): Remove static declaration. gcc/testsuite/ChangeLog * c-c++-common/gomp/declare-variant-2.c: Update expected output. * c-c++-common/gomp/metadirective-condition-constexpr.c: New. * c-c++-common/gomp/metadirective-condition.c: New. * c-c++-common/gomp/metadirective-error-recovery.c: Update expected output. * g++.dg/gomp/metadirective-condition-class.C: New. * g++.dg/gomp/metadirective-condition-template.C: New. (cherry picked from commit 08c299a410b9314957e48a87f5bf50a4c034b744)
2025-06-05ada: Spurious compilation error with repeated loop indexJavier Miranda1-0/+15
When multiple for-loop statements in the same scope use the same index name to iterate through container elements, the compiler reports a spurious error indicating a conflict between index names. gcc/ada/ChangeLog: * exp_ch7.adb (Process_Object_Declaration): Avoid generating duplicate names for master nodes.
2025-06-05ada: Exception-raising loop incorrectly eliminatedSteve Baird1-1/+6
If the body of a loop includes a raise statement then the loop should not be considered to be free of side-effects and therefore eligible for elimination by the compiler. gcc/ada/ChangeLog: * sem_util.adb (Side_Effect_Free_Statements): Return False if the statement list includes an explicit (i.e. Comes_From_Source) raise statement.
2025-06-05ada: Fix crash on access to protected returnRonan Desplanques1-2/+3
The generation of the check mandated by Ada issue AI05-0073 was not done handled properly for protected types when used through subtypes. This patch fixes the issue. gcc/ada/ChangeLog: * exp_ch4.adb (Tagged_Membership): Fix for protected types.
2025-06-05ada: Tweak caching of streaming subprogramsRonan Desplanques1-2/+2
gcc/ada/ChangeLog: * exp_attr.adb (Interunit_Ref_OK): Tweak categorization of compilation units.
2025-06-05ada: Implement built-in-place expansion of two-pass array aggregatesEric Botcazou5-216/+324
These are array aggregates containing only component associations that are iterated with iterator specifications, as per RM 4.3.3(20.2/5-20.4/5). It is implemented for the array aggregates that are used to initialize an object, as specified by RM 7.6(17.2/3-17.3/3) for immutably limited types and types that need finalization, but for all types like other aggregates. gcc/ada/ChangeLog: * exp_aggr.adb (Build_Two_Pass_Aggr_Code): New function containing most of the code initially present in Two_Pass_Aggregate_Expansion. (Two_Pass_Aggregate_Expansion): Remove redundant N parameter. Implement built-in-place expansion for (static) object declarations and allocators, using Build_Two_Pass_Aggr_Code for the main work. (Expand_Array_Aggregate): Adjust Two_Pass_Aggregate_Expansion call. Replace Etype (N) by Typ in a couple of places. * exp_ch3.adb (Expand_Freeze_Array_Type): Remove special case for two-pass array aggregates. (Expand_N_Object_Declaration): Do not adjust the object when it is initialized by a two-pass array aggregate. * exp_ch4.adb (Expand_Allocator_Expression): Apply the processing used for container aggregates to two-pass array aggregates. * exp_ch6.adb (Validate_Subprogram_Calls): Skip calls present in initialization expressions of N_Object_Declaration nodes that have No_Initialization set. * sem_ch3.adb (Analyze_Object_Declaration): Detect the cases of an array originally initialized by an aggregate consistently.