aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2024-05-06ada: Spurious reference warning on qualified expressionJustin Squirek1-0/+10
This patch fixes an error in the compiler whereby an assignment to an out formal (whose type requires a predicate check) can lead to spurious "value may be referenced before it has a value" warnings when the RHS is a qualified expression. gcc/ada/ * sem_warn.adb (Within_Postcondition): Add case to ignore references within generated predicate function calls.
2024-05-06ada: Fix RM reference in commentRonan Desplanques1-1/+1
The RM 2.2(15) that the comment mentioned before this patch doesn't exist. It's pretty clear that the comment meant to refer to RM 2.2(14) instead. gcc/ada/ * hostparm.ads: Fix reference to RM clause.
2024-05-06ada: Make a couple of comment tweaksEric Botcazou1-5/+4
This removes a reference to a mechanism that didn't make it into the final implementation and completes the description of another. gcc/ada/ * libgnat/s-finpri.ads (Finalize_Master): Remove obsolete reference in the description. (Finalize_Object): Document the effects of repeated calls.
2024-05-06ada: Rework processing of special objects needing finalizationEric Botcazou10-380/+500
This reworks the processing of special objects needing finalization in the new implementation. These special objects, i.e. return object in extended return statements and transient objects, cannot be automatically handled by the post-processing phase because they have additional requirements, either conditional finalization for the former or immediate finalization for the latter and, therefore, a specific processing during expansion is needed for them before the post-processing phase can complete the work. The previous scheme used to do minimal processing during expansion, leaving the bulk of the work to the post-processing phase. Unfortunately this scheme turned out not to be stable for Expression_With_Actions nodes under copying by means of New_Copy_Tree or equivalent devices. The new scheme moves a bit more processing to the expansion, namely the generation of the attachment to the master node, whose result can then be naturally copied by New_Copy_Tree. A side effect is to further simplify the implementation of Build_Finalizer in Exp_Ch7, which has one fewer special case to deal with. gcc/ada/ * einfo.ads (Finalization_Master_Node_Or_Object): Rename into... (Finalization_Master_Node): ...this and adjust description. * exp_ch4.adb (Process_Transient_In_Expression): Attach the object to its master node here. * exp_ch7.ads (Attach_Object_To_Master_Node): New declaration. * exp_ch7.adb (Attach_Object_To_Master_Node): New procedure. (Build_Finalizer.Process_Declarations): Examine the type of a variable to spot master nodes. (Build_Finalizer.Process_Object_Declaration): Look only at the object and deal specifically with the case of a master node. (Build_Finalizer.Build_BIP_Cleanup_Stmts): Move to child function of Attach_Object_To_Master_Node. (Build_Finalizer.Make_Address_For_Finalize): Move to... (Insert_Actions_In_Scope_Around.Process_Transient_In_Scope): Attach the object to its master node here. (Make_Address_For_Finalize): ...here. (Make_Master_Node_Declaration): Adjust to above renaming and set Finalization_Master_Node only on the object. (Make_Suppress_Object_Finalize_Call): Adjust to above renaming and attach the object to its master node here. * exp_util.adb (Requires_Cleanup_Actions): Examine the type of a variable to spot master nodes. * gen_il-fields.ads (Opt_Field_Enum): Adjust to above renaming. * gen_il-gen-gen_entities.adb (Allocatable_Kind): Likewise. * rtsfind.ads (RE_Id): Add RE_Chain_Node_To_Master. (RE_Unit_Table): Add entry for RE_Chain_Node_To_Master. * libgnat/s-finpri.ads (Chain_Node_To_Master): New declaration. * libgnat/s-finpri.adb (Chain_Node_To_Master): New procedure. (Attach_Object_To_Master): Call it. (Finalize_Master): Do not raise Program_Error on null addresses. (Finalize_Object): Add assertion that the address is not null.
2024-05-06ada: Replace references to PO_Simple by Protected_Objects in commentsEric Botcazou3-4/+10
The child unit was renamed a while ago. gcc/ada/ * libgnarl/s-taprob.ads (Protection): Add cross-reference to the counterpart in System.Tasking.Protected_Objects.Entries. * libgnarl/s-taskin.ads (Locking Rules): Replace PO_Simple by Protected_Objects. * libgnarl/s-tpoben.ads (Protection_Entries): Likewise.
2024-05-06ada: Fix wrong Finalization_Size for No_Heap_Finalization objectsEric Botcazou1-1/+9
When an access type is subject to the No_Heap_Finalization pragma, no header is added in front of objects allocated through it, and the value returned by Finalization_Size is defined to be the size of this header. gcc/ada/ * exp_attr.adb (Expand_N_Attribute_Reference) <Finalization_Size>: Return 0 if the prefix is a dereference of an access value subject to the No_Heap_Finalization pragma.
2024-05-06ada: Fix spurious warning emissionRonan Desplanques5-10/+13
This patch fixes a bug where GNAT would emit incorrect warnings about obsolescent syntax for array aggregates with generics and particular arrangements of Ada version pragmas. This patch also removes a syntactic field that was introduced to support the emission of this warning, but is no longer required. gcc/ada/ * exp_imgv.adb (Append_Table_To): Remove reference to removed field. * gen_il-fields.ads: Remove Is_Enum_Array_Aggregate field. * gen_il-gen-gen_nodes.adb: Likewise. * sem_aggr.adb: Tweak warning emission condition. * sinfo.ads: Remove documentation for Is_Enum_Array_Aggregate.
2024-05-06ada: Replace redundant conditions with assertionsPiotr Trojanek3-3/+3
Fix warnings from the CodePeer. The code structure is essentially: if A and B then ... elsif not A and not B then ... elsif A then ... elsif B then ... -- this condition is redundant end if; and it causes CodePeer to say "exception is raised in a conditional branch", which most likely means that the condition is redundant. gcc/ada/ * make.adb (Scan_Make_Arg): Remove redundant condition. * switch-b.adb (Scan_Debug_Switches): Likewise. * switch-c.adb (Scan_Front_End_Switches): Likewise.
2024-05-06ada: Fix detection of (Un)Hide_Info pragma in GNATprove modeYannick Moy1-1/+4
Spec or body may not be in a list for subunit. gcc/ada/ * inline.adb (Can_Be_Inlined_In_GNATprove_Mode): Add guard.
2024-05-06ada: Fix missing associated node for packed array itypesPiotr Trojanek2-13/+6
After decoration, itypes should have its associated node set. gcc/ada/ * exp_pakd.adb (Create_Packed_Array_Impl_Type): Set associated node for the packed array itype. * exp_util.adb (Possible_Side_Effect_In_SPARK): Remove workaround for a missing associated node.
2024-05-06ada: Don't propagate convention to internal subprogramsRichard Kenner1-11/+17
AI95-117 requires that all new primitives of a tagged type must inherit the convention of the full view of the type. However, we need not do this for primitives that are internally-generated, such as for finalization. There are issues with GNAT LLVM when primitives have convention C since the UC from that subprogram type to the type used in the dispatch table will generate a warning. We're not doing anything here about the case where the convention C is explicit or there are user-specified primitives on a type with convention C, but let's not make the problem worse by putting convention C on internal subprograms. gcc/ada/ * freeze.adb (Freeze_Entity): When changing the convention of primitive to match that of the type, only do this for user-specified primitives.
2024-05-06ada: Fix memory leak in 'ImageBob Duff1-0/+8
Fix memory leak in 'Image by managing the secondary stack in scopes that call the new Ada 2020 'Image, which calls 'Put_Image and then Get, which returns on the secondary stack. gcc/ada/ * exp_put_image.adb (Build_Image_Call): Call Set_Uses_Sec_Stack on the current scope. We don't do this at all call sites, because there are three; better to do it here.
2024-05-06ada: Extend Round attribute to ordinary fixed point typesEric Botcazou3-479/+505
The attribute is only defined by the language for decimal fixed point types (RM 3.5.10(12)) but it could be useful to have it for ordinary fixed point types too because conversions from floating point truncate in both cases. gcc/ada/ * sem_attr.adb (Analyze_Attribute) <Attribute_Round>: Also accept it for ordinary fixed point types. * doc/gnat_rm/implementation_defined_attributes.rst (Round): New. * gnat_rm.texi: Regenerate.
2024-05-06ada: Fix non-idiomatic constructEric Botcazou1-1/+1
gcc/ada/ * exp_ch3.adb (Expand_Freeze_Class_Wide_Type): Use No instead of not Present.
2024-05-06ada: Adjust source location for degenerate scope masterEric Botcazou1-2/+12
When the finalization scope master degenerates into a simple master node, the latter must inherit the source location that the former would have had. gcc/ada/ * exp_ch7.adb (Build_Finalizer.Process_Object_Declaration): Adjust the Sloc of the master node declaration in the degenerate case.
2024-05-06ada: Prevent inlining in GNATprove for memory leaksYannick Moy3-4/+64
In some cases, inlining a call in GNATprove could lead to missing a memory leak. Recognize such cases and do not inline such calls. gcc/ada/ * inline.adb (Call_Can_Be_Inlined_In_GNATprove_Mode): Add case to prevent inlining of call. * inline.ads: Likewise. * sem_res.adb (Resolve_Call): Update comment and message.
2024-05-06ada: Partial implementation of redesign of support for object finalizationEric Botcazou17-1514/+1328
This set of changes is a partial reimplemention of the support for Ada finalization in the GNAT compiler and run-time library, based on the redesign done by Hristian Kirtchev in February 2022. It only affects the scope-based finalization of objects and does not touch the support for finalization of dynamically allocated objects. It also does not modify the internal architecture of this support in the front-end but only changes its output, i.e. the expanded code. In other words, the code-based dispatching scheme in finalizers and the hook-based approach for transient objects are replaced by finalization scope masters and master nodes, which maintain a list of objects needing finalization, but the expansion of the code that builds these masters is still performed mainly during a dedicated post-processing phase. gcc/ada/ * Makefile.rtl (GNATRTL_NONTASKING_OBJS): Add s-finpri$(objext). * contracts.adb (Add_Call_Helper): Append freeze actions to the class-wide type rather than the specific tagged type. * einfo.ads (Finalization_Master_Node_Or_Node): Document. (Status_Flag_Or_Transient_Decl): Remove. * exp_attr.adb (Expand_N_Attribute_Reference) <Address>: Do not adjust a return object of a class-wide interface type. * exp_ch3.adb (Expand_Freeze_Class_Wide_Type): Add test that Finalize_Address is not already present as a condition for calling Make_Finalize_Address_Body. (Expand_Freeze_Record_Type): Call Make_Finalize_Address_Body for class-wide types of both regular tagged types and interface types. * exp_ch4.adb (Process_Transients_In_Expression): Replace the use of hooks with the use of master nodes. * exp_ch6.adb (Build_Flag_For_Function): Delete. (Expand_N_Extended_Return_Statement): Create a master node for the return object if it does not exist. At the end of the statement, generate a call to Suppress_Object_Finalize. (Expand_Non_Function_Return): Likewise just before the return. * exp_ch7.ads (Make_Master_Node_Declaration): Declare. (Make_Suppress_Object_Finalize_Call): Likewise. * exp_ch7.adb (Build_Finalization_Master): Defer generating the call to Set_Finalize_Address until freezing if the Finalize_Address procedure has not been analyzed yet. (Build_Finalizer): Reimplement the expansion using a finalization scope master per finalizer. (Insert_Actions_In_Scope_Around): Replace finalization hooks by master nodes and calls to the Finalize_Object. (Make_Master_Node_Declaration): New procedure. (Make_Suppress_Object_Finalize_Call): Likewise. * exp_util.ads (Build_Transient_Object_Statements): Delete. * exp_util.adb (Build_Transient_Object_Statements): Likewise. (Requires_Cleanup_Actions): Remove obsolete code and return true for master nodes. * gen_il-fields.ads (Opt_Field_Enum): Add Finalization_Master_Node_Or_Object and remove Status_Flag_Or_Transient_Decl. * gen_il-gen-gen_entities.adb (Allocatable_Kind): Likewise. * rtsfind.ads (RTU_Id): Add System_Finalization_Primitives. (RE_Id): Add entities of System_Finalization_Primitives. (RE_Unit_Table): Add entries for them. * sem_ch3.adb (Analyze_Object_Declaration): For an array whose type has an unconstrained first subtype and a controlled component, set the Is_Constr_Array_Subt_With_Bounds flag. * libgnat/s-finpri.ads: New file. * libgnat/s-finpri.adb: Likewise.
2024-05-06ada: Do not inline in GNATprove the subprograms with (Un)Hide_InfoYannick Moy1-3/+86
The annotations Hide_Info and Unhide_Info in GNATprove are meant to give special visibility in the corresponding scope to the precise definition of some entities. Hence, such scopes should not be inlined in GNATprove. gcc/ada/ * inline.adb (Can_Be_Inlined_In_GNATprove_Mode): Adapt checking.
2024-05-06expmed: TRUNCATE value1 if needed in store_bit_field_using_insvYunQiang Su2-3/+27
PR target/113179. In `store_bit_field_using_insv`, we just use SUBREG if value_mode >= op_mode, while in some ports, a sign_extend will be needed, such as MIPS64: If either GPR rs or GPR rt does not contain sign-extended 32-bit values (bits 63..31 equal), then the result of the operation is UNPREDICTABLE. The problem happens for the code like: struct xx { int a:4; int b:24; int c:3; int d:1; }; void xx (struct xx *a, long long b) { a->d = b; } In the above code, the hard register contains `b`, may be note well sign-extended. gcc/ PR target/113179 * expmed.cc(store_bit_field_using_insv): TRUNCATE value1 if needed. gcc/testsuite PR target/113179 * gcc.target/mips/pr113179.c: New tests.
2024-05-06Daily bump.GCC Administrator4-1/+23
2024-05-05Fortran: fix issues with class(*) assignment [PR114827]Harald Anlauf3-0/+164
gcc/fortran/ChangeLog: PR fortran/114827 * trans-array.cc (gfc_alloc_allocatable_for_assignment): Take into account _len of unlimited polymorphic entities when calculating the effective element size for allocation size and array span. Set _len of lhs to _len of rhs. * trans-expr.cc (trans_class_assignment): Take into account _len of unlimited polymorphic entities for allocation size. gcc/testsuite/ChangeLog: PR fortran/114827 * gfortran.dg/asan/unlimited_polymorphic_34.f90: New test.
2024-05-04Remove m_nloops field from loop_versioningAndrew Pinski1-5/+2
This is a small cleanup of loop_versioning where m_nloops is only used in the constructor so we can remove the whole field. Bootstrapped and tested on x86_64-linux-gnu. gcc/ChangeLog: * gimple-loop-versioning.cc (loop_versioning): Remove m_nloops field. (loop_versioning::loop_versioning): Remove initialization of m_nloops field and move it to be a local variable. (loop_versioning::analyze_blocks): Fix formating. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2024-05-05Daily bump.GCC Administrator2-1/+239
2024-05-04Add prange entries in gimple-range-op.cc.Aldy Hernandez1-0/+36
gcc/ChangeLog: * gimple-range-op.cc (class cfn_pass_through_arg1): Add overloads for prange operations. (cfn_strlen): Same.
2024-05-04Implement operator_ge for prange....Aldy Hernandez2-0/+120
gcc/ChangeLog: * range-op-mixed.h: Add overloaded declarations for pointer variants. * range-op-ptr.cc (operator_ge::fold_range): New. (operator_ge::op1_range): New. (operator_ge::op2_range): New. (operator_ge::op1_op2_relation): New. (operator_ge::pointers_handled_p): New.
2024-05-04Implement operator_gt for prange.Aldy Hernandez2-0/+118
gcc/ChangeLog: * range-op-mixed.h: Add overloaded declarations for pointer variants. * range-op-ptr.cc (operator_gt::fold_range): New. (operator_gt::op1_range): New. (operator_gt::op2_range): New. (operator_gt::op1_op2_relation): New. (operator_gt::pointers_handled_p): New.
2024-05-04Implement operator_le for prange.Aldy Hernandez2-0/+120
gcc/ChangeLog: * range-op-mixed.h: Add overloaded declarations for pointer variants. * range-op-ptr.cc (operator_le::fold_range): New. (operator_le::op1_range): New. (operator_le::op2_range): New. (operator_le::op1_op2_relation): New. (operator_le::pointers_handled_p): New.
2024-05-04Implement operator_lt for prange.Aldy Hernandez2-0/+186
gcc/ChangeLog: * range-op-mixed.h: Add overloaded declarations for pointer variants. * range-op-ptr.cc (max_limit): New. (min_limit): New. (build_lt): New. (build_le): New. (build_gt): New. (build_ge): New. (operator_lt::fold_range): New. (operator_lt::op1_range): New. (operator_lt::op2_range): New. (operator_lt::op1_op2_relation): New. (operator_lt::pointers_handled_p): New.
2024-05-04Implement operator_equal for prange.Aldy Hernandez2-0/+129
gcc/ChangeLog: * range-op-mixed.h: Add overloaded declarations for pointer variants. * range-op-ptr.cc (operator_equal::fold_range): New. (operator_equal::op1_range): New. (operator_equal::op2_range): New. (operator_equal::op1_op2_relation): New. (operator_equal::pointers_handled_p): New.
2024-05-04Implement operator_not_equal for prange.Aldy Hernandez2-0/+130
gcc/ChangeLog: * range-op-mixed.h: Add overloaded declarations for pointer variants. * range-op-ptr.cc (operator_not_equal::fold_range): New. (operator_not_equal::op1_range): New. (operator_not_equal::op2_range): New. (operator_not_equal::op1_op2_relation): New. (operator_not_equal::pointers_handled_p): New.
2024-05-04Implement operator_bitwise_or for prange.Aldy Hernandez2-0/+12
We seem to have a range-op entry for pointer bitwise OR that we've inherited from the original VRP implementation, but it never gets used. If this is not valid gimple, we can safely remove this entry. gcc/ChangeLog: * range-op-mixed.h: Add overloaded declarations for pointer variants. * range-op-ptr.cc (operator_bitwise_or::pointers_handled_p): New.
2024-05-04Implement operator_bitwise_and for prange.Aldy Hernandez2-0/+36
gcc/ChangeLog: * range-op-mixed.h: Add overloaded declarations for pointer variants. * range-op-ptr.cc (operator_bitwise_and::fold_range): New. (operator_bitwise_and::pointers_handled_p): New.
2024-05-04Implement operator_pointer_diff for prange.Aldy Hernandez1-0/+32
gcc/ChangeLog: * range-op-ptr.cc (operator_pointer_diff::op1_op2_relation_effect): New. (operator_pointer_diff::pointers_handled_p): New.
2024-05-04Implement pointer_plus_operator for prange.Aldy Hernandez1-0/+98
gcc/ChangeLog: * range-op-ptr.cc (class pointer_plus_operator): Add overloaded declarations for pointer variants. (pointer_plus_operator::fold_range): New. (pointer_plus_operator::op2_range): New. (pointer_plus_operator::pointers_handled_p): New.
2024-05-04Implement operator_addr_expr for prange.Aldy Hernandez2-0/+42
gcc/ChangeLog: * range-op-mixed.h: Add overloaded declarations for pointer variants. * range-op-ptr.cc (operator_addr_expr::op1_range): New. (operator_addr_expr::pointers_handled_p): New.
2024-05-04Implement operator_min and operator_max for prange.Aldy Hernandez2-0/+82
gcc/ChangeLog: * range-op-mixed.h: Add overloaded declarations for pointer variants. * range-op-ptr.cc (operator_min::fold_range): New. (operator_min::pointers_handled_p): New. (operator_max::fold_range): New. (operator_max::pointers_handled_p): New.
2024-05-04Implement operator_cast for prange.Aldy Hernandez2-0/+273
gcc/ChangeLog: * range-op-mixed.h: Add overloaded declarations for pointer variants. * range-op-ptr.cc (operator_cast::fold_range): New. (operator_cast::op1_range): New. (operator_cast::lhs_op1_relation): New. (operator_cast::pointers_handled_p): New.
2024-05-04Implement operator_cst for prange.Aldy Hernandez2-0/+27
gcc/ChangeLog: * range-op-mixed.h: Add overloaded declarations for pointer variants. * range-op-ptr.cc (operator_cst::fold_range): New. (operator_cst::pointers_handled_p): New.
2024-05-04Implement operator_identity for prange.Aldy Hernandez2-0/+57
gcc/ChangeLog: * range-op-mixed.h: Add overloaded declarations for fold_range, op1_range, lhs_op1_relation, pointers_handled_p. * range-op-ptr.cc (operator_identity::fold_range): New. (operator_identity::lhs_op1_relation): New. (operator_identity::op1_range): New. (operator_identity::pointers_handled_p): New.
2024-05-04Implement range-op dispatch for prange.Aldy Hernandez4-0/+474
This patch adds the range-op dispatch code for prange, and adds some temporary sanity checks (for flag_checking only) to make sure we handle all the pointer/integer variants. In order to make sure I got all the combinations right, I started with a clean slate, trapping on all pointer operands. Then I added support for each one piecemeal. To verify the work, I added a pointers_handled_p() helper that is implemented for each range-op entry and returns TRUE iff the operator can handle a given combination of pointers. If this helper returns false, we will trap, because it indicates an operator that was not implemented. This is temporary checking code, and I will rip it out once the the dust has settled in a few days. gcc/ChangeLog: * range-op-mixed.h: Add using declarator for all classes. * range-op-ptr.cc (range_operator::pointers_handled_p): New. (range_operator::fold_range): New. (range_operator::op1_op2_relation_effect): New. (range_operator::op1_range): New. (range_operator::op2_range): New. (range_operator::op1_op2_relation): New. (range_operator::lhs_op1_relation): New. (range_operator::update_bitmask): New. (class pointer_plus_operator): New. (class operator_pointer_diff): New. (class hybrid_min_operator): New. (class hybrid_max_operator): New. * range-op.cc: Add RO_PPP, RO_PPI, RO_IPP, RO_IPI, RO_PIP, RO_PII. (range_op_handler::discriminator_fail): New. (has_pointer_operand_p): New. (range_op_handler::fold_range): Add pointer support. (range_op_handler::op1_range): Same. (range_op_handler::op2_range): Same. (range_op_handler::lhs_op1_relation): Same. (range_op_handler::lhs_op2_relation): Same. (range_op_handler::op1_op2_relation): Same. (class operator_div): Add using. (class operator_lshift): Add using. (class operator_rshift):Add using. (class operator_trunc_mod):Add using. (class operator_absu):Add using. * range-op.h (enum range_op_dispatch_type): New. Add extern definitions for RO_*.
2024-05-04Add prange implementation for get_legacy_range.Aldy Hernandez1-2/+33
gcc/ChangeLog: * value-range.cc (get_legacy_range): New version for prange.
2024-05-04Add hashing support for prange.Aldy Hernandez1-0/+16
gcc/ChangeLog: * value-range.cc (add_vrange): Add prange support.
2024-05-04Add storage support for prange.Aldy Hernandez2-0/+150
gcc/ChangeLog: * value-range-storage.cc (vrange_allocator::clone_varying): Add prange support. (vrange_allocator::clone_undefined): Same. (vrange_storage::alloc): Same. (vrange_storage::set_vrange): Same. (vrange_storage::get_vrange): Same. (vrange_storage::fits_p): Same. (vrange_storage::equal_p): Same. (prange_storage::alloc): New. (prange_storage::prange_storage): New. (prange_storage::set_prange): New. (prange_storage::get_prange): New. (prange_storage::equal_p): New. (prange_storage::fits_p): New. * value-range-storage.h (class prange_storage): Add prange support.
2024-05-04Add streaming support for prange.Aldy Hernandez2-0/+22
gcc/ChangeLog: * data-streamer-in.cc (streamer_read_value_range): Add prange support. * data-streamer-out.cc (streamer_write_vrange): Same.
2024-05-04Implement basic prange class.Aldy Hernandez4-28/+500
This provides a bare prange class with bounds and bitmasks. It will be a drop-in replacement for pointer ranges, so we can pull their support from irange. The range-op code will be contributed as a follow-up. The code is disabled by default, as irange::supports_p still accepts pointers: inline bool irange::supports_p (const_tree type) { return INTEGRAL_TYPE_P (type) || POINTER_TYPE_P (type); } Once the prange operators are implemented in range-ops, pointer support will be removed from irange to activate pranges. gcc/ChangeLog: * value-range-pretty-print.cc (vrange_printer::visit): New. * value-range-pretty-print.h: Declare prange visit() method. * value-range.cc (vrange::operator=): Add prange support. (vrange::operator==): Same. (prange::accept): New. (prange::set_nonnegative): New. (prange::set): New. (prange::contains_p): New. (prange::singleton_p): New. (prange::lbound): New. (prange::ubound): New. (prange::union_): New. (prange::intersect): New. (prange::operator=): New. (prange::operator==): New. (prange::invert): New. (prange::verify_range): New. (prange::update_bitmask): New. (range_tests_misc): Use prange. * value-range.h (enum value_range_discriminator): Add VR_PRANGE. (class prange): New. (Value_Range::init): Add prange support. (Value_Range::operator=): Same. (Value_Range::supports_type_p): Same. (prange::prange): New. (prange::supports_p): New. (prange::supports_type_p): New. (prange::set_undefined): New. (prange::set_varying): New. (prange::set_nonzero): New. (prange::set_zero): New. (prange::contains_p): New. (prange::zero_p): New. (prange::nonzero_p): New. (prange::type): New. (prange::lower_bound): New. (prange::upper_bound): New. (prange::varying_compatible_p): New. (prange::get_bitmask): New. (prange::fits_p): New.
2024-05-04Minimal prange class showing inlining degradation to VRP.Aldy Hernandez1-0/+59
There is a 2% slowdown to VRP unrelated to the work at hand. This patch is a skeleton implementation of prange that exhibits this degradation. It is meant as a place in the commit history we can return to in order to revisit the issue. The relevant discussion is here: https://gcc.gnu.org/pipermail/gcc/2024-May/243898.html gcc/ChangeLog: * value-range.h (class prange): New.
2024-05-04Daily bump.GCC Administrator6-1/+240
2024-05-03Fix printing COMPOUND_EXPR in .original [PR23872]Andrew Pinski2-19/+9
Starting with the merge of the openmp branch into the trunk (r0-73077-g953ff28998b59b), COMPOUND_EXPR started to be printed as `expr; , expr` which is wrong. This was due to the wrong conversion of dumping_stmts into `!(flags & TDF_SLIM)`. That is wrong as we are not dumping stmts at this point (`!(flags & TDF_SLIM)` was always true for this case as TDF_SLIM case was handled before hand). So switch it to be always false. Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/ChangeLog: PR middle-end/23872 * tree-pretty-print.cc (dump_generic_node <case COMPOUND_EXPR>): Fix calls to dump_generic_node and also remove unreachable code that is testing `flags & TDF_SLIM`. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/atomic-21.f90: Update testcase for the removal of `;`. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2024-05-03c++: initializer_list<string> and EH [PR114935]Jason Merrill4-18/+60
When we initialize an array of a type with a non-trivial destructor, such as the backing array for the initializer_list, we have a cleanup to destroy any constructed elements if a later constructor throws. When the array being created is a variable, the end of that EH region naturally coincides with the beginning of the EH region for the cleanup for the variable as a whole. But if the array is a temporary, or a subobject of one, the array cleanup region lasts for the rest of the full-expression, along with the normal cleanup for the TARGET_EXPR. As a result, when tata throws we clean it up twice. Before r14-1705 we avoided this by disabling the array cleanup in split_nonconstant_init, but after that we don't go through split_nonconstant_init, so let's handle it in cp_genericize_target_expr. PR c++/114935 gcc/cp/ChangeLog: * cp-gimplify.cc (cp_genericize_init): Add flags parm. (cp_genericize_init_expr): Pass nullptr. (cp_genericize_target_expr): Handle cleanup flags. * typeck2.cc (build_disable_temp_cleanup): Factor out of... (split_nonconstant_init): ...here. * cp-tree.h (build_disable_temp_cleanup): Declare. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/initlist-eh1.C: New test.
2024-05-03PR modula2/114929 extra for loop iteration count regression testsGaius Mulley3-0/+84
This patch introduces three more for loop tests checking the iteration count using the CHAR and enumeration data types. gcc/testsuite/ChangeLog: PR modula2/114929 * gm2/pim/run/pass/testforloopchar.mod: New test. * gm2/pim/run/pass/testforloopchar2.mod: New test. * gm2/pim/run/pass/testforloopenum.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>