aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_util.ads
AgeCommit message (Collapse)AuthorFilesLines
2020-11-25[Ada] Document attribute Has_Tagged_Values in GNAT RMPiotr Trojanek1-3/+1
gcc/ada/ * doc/gnat_rm/implementation_defined_attributes.rst (Has_Tagged_Values): Document based on the existing description of Has_Access_Type and the comment for Has_Tagged_Component, which is where frontend evaluates this attribute. * gnat_rm.texi: Regenerate. * sem_attr.adb (Analyze_Attribute): Merge processing of Has_Access_Type and Has_Tagged_Component attributes. * sem_util.adb (Has_Access_Type): Fix casing in comment. * sem_util.ads (Has_Tagged_Component): Remove wrong (or outdated) comment about the use of this routine to implement the equality operator.
2020-11-24[Ada] Handle correctly current instance of PO in local subprogram GlobalYannick Moy1-2/+13
gcc/ada/ * sem_prag.adb (Analyze_Global_Item): Handle specially the current instance of a PO. * sem_util.ads (Is_Effectively_Volatile, Is_Effectively_Volatile_For_Reading): Add parameter Ignore_Protected. * sem_util.adb (Is_Effectively_Volatile, Is_Effectively_Volatile_For_Reading): Add parameter Ignore_Protected to compute the query results ignoring protected objects/types. (Is_Effectively_Volatile_Object, Is_Effectively_Volatile_Object_For_Reading): Adapt to new signature.
2020-10-23[Ada] Further Ada 2020 work on accessibility checkingJustin Squirek1-12/+65
gcc/ada/ * checks.adb (Apply_Accessibility_Check): Skip checks against the extra accessibility of a function result when in Ada 2005 mode or earlier. * exp_ch3.adb (Build_Initialization_Call): Modify accessibility level calls to use Accessibility_Level. (Expand_N_Object_Declaration): Modify accessibility level calls to use Accessibility_Level. * exp_ch4.adb (Expand_Allocator_Expression): Add static check for anonymous access discriminants. Remove unneeded propagation of accessibility actual. (Expand_N_In): Modify accessibility level calls to use Accessibility_Level. (Expand_N_Type_Conversion): Modify accessibility level calls to use Accessibility_Level. * exp_ch5.adb (Expand_N_Assignment_Statement): Modify accessibility level calls to use Accessibility_Level. * exp_ch6.adb (Expand_Call_Helper): Rewrite accessibility calculation for the extra accessibility of result actual in function calls, and modify accessibility level calls to use Accessibility_Level. (Check_Against_Result_Level): Removed. * exp_ch9.adb (Expand_N_Requeue_Statement): Add dynamic accessibility check for requeues * sem_attr.adb (Resolve_Attribute): Modify accessibility level calls to use Accessibility_Level. * sem_ch13.adb (Associate_Storage_Pool): Modify accessibility level calls to use Accessibility_Level. * sem_ch4.adb (Analyze_Call): Add static check for explicitly aliased formals in function calls within return statements. * sem_ch6.adb (Check_Return_Construct_Accessibility): Rewrite routine to account for non-aggregate return objects. (Generate_Minimum_Accessibility): Created. (Analyze_Call): Modify accessibility level calls to use Accessibility_Level. (Analyze_Subprogram_Body_Helper): Add generation of minimum accessibility for the extra accessibility of the function result. * sem_ch9.adb (Analyze_Requeue): Modify accessibility level calls to use Accessibility_Level. * sem_res.adb: (Check_Aliased_Parameters): Modify accessibility level calls to use Accessibility_Level. (Valid_Conversion): Modify accessibility level calls to use Accessibility_Level. * sem_util.adb, sem_util.ads (Accessibility_Level_Helper): Renamed to Accessibility_Level, add detection for functions in prefix notation, and add cases where to return zero when specified. Modified to take new, more descriptive, parameters. (Accessibility_Level): Created. (Function_Call_Level): Removed. (Function_Call_Or_Allocator_Level): Created to centralize the calculation accessibility levels for function calls and allocators. (Static_Accessibility_Level): Removed. (Dynamic_Accessibility_Level): Removed. (Get_Dynamic_Accessibility): Renamed from Get_Accessibility. (In_Return_Value): Created to determine if a given expression contributes to the current function's return value. (Is_Master): Created. (Is_Explicitly_Aliased): Created
2020-10-23[Ada] Implement new legality rules introduced in C.6(12) by AI12-0363Eric Botcazou1-6/+6
gcc/ada/ * doc/gnat_rm/implementation_defined_pragmas.rst (VFA): Remove uage restrictions in conjunction with Atomic and Aliased. * gnat_rm.texi: Regenerate. * aspects.ads (Aspect_Id): Add Aspect_Full_Access_Only. (Is_Representation_Aspect): Likewise. (Aspect_Names): Likewise. (Aspect_Delay): Likewise. * einfo.ads (Is_Atomic_Or_VFA): Rename into... (Is_Full_Access): ...this. (Is_Volatile_Full_Access): Document new usage for Full_Access_Only. * einfo.adb (Is_Atomic_Or_VFA): Rename into... (Is_Full_Access): ...this. * freeze.ads (Is_Atomic_VFA_Aggregate): Rename into... (Is_Full_Access_Aggregate): ...this. * freeze.adb (Is_Atomic_VFA_Aggregate): Rename into... (Is_Full_Access_Aggregate): ...this. Adjust to above renaming. (Freeze_Array_Type): Likewise. (Freeze_Entity): Likewise. * exp_aggr.adb (Aggr_Assignment_OK_For_Backend): Likewise. (Expand_Record_Aggregate): Likewise. * exp_ch4.adb (Expand_N_Op_Eq): Likewise. * exp_ch5.adb (Expand_Assign_Array): Likewise. * exp_ch8.adb (Evaluation_Required): Likewise. * layout.adb (Layout_Type): Likewise. (Set_Composite_Alignment): Likewise. * sem_aux.ads (Has_Rep_Item): Delete. * sem_aux.adb (Has_Rep_Item): Likewise. * sem_attr.adb (Resolve_Attribute) <Attribute_Access>: Implement new legality rules in C.6(12). * sem_ch12.adb (Instantiate_Object): Likewise. * sem_res.adb (Resolve_Actuals): Likewise. * sem_ch13.adb (Inherit_Delayed_Rep_Aspects): Deal with aspect Full_Access_Only. (Check_False_Aspect_For_Derived_Type): Likewise. (Make_Pragma_From_Boolean_Aspect): Test for the presence of Expr. Deal with aspect Full_Access_Only. (Analyze_Aspects_At_Freeze_Point): Likewise. (Analyze_One_Aspect): Do not set Delay_Required to true even for Always_Delay boolean aspects if they have no expression. Force Delay_Required to true for aspect Full_Access_Only in all cases. Reject aspect Full_Access_Only if not in Ada 2020 mode. (Check_Aspect_At_End_Of_Declarations): Deal with empty expression. (Check_Aspect_At_Freeze_Point): Likewise. (Rep_Item_Entity): Delete. (Inherit_Aspects_At_Freeze_Point): Align handling for Bit_Order with that for Scalar_Storage_Order. * sem_prag.adb (Check_Atomic_VFA): Delete. (Check_VFA_Conflicts): Likewise. (Check_Full_Access_Only): New procedure. (Process_Atomic_Independent_Shared_Volatile): Call to implement the new legality checks in C.6(8/2) and mark the entity last. (Analyze_Pragma) <Pragma_Atomic_Components>: Remove obsolete check. * sem_util.ads (Is_Atomic_Or_VFA_Object): Rename into... (Is_Full_Access_Object): ...this. (Is_Subcomponent_Of_Atomic_Object): Rename into... (Is_Subcomponent_Of_Full_Access_Object): ...this. * sem_util.adb (Inherit_Rep_Item_Chain): Use Present_In_Rep_Item. (Is_Atomic_Or_VFA_Object): Rename into... (Is_Full_Access_Object): ...this. (Is_Subcomponent_Of_Atomic_Object): Rename into... (Is_Subcomponent_Of_Full_Access_Object): ...this and adjust. * snames.ads-tmpl (Name_Full_Access_Only): New name of aspect. * gcc-interface/decl.c (gnat_to_gnu_entity): Adjust for renaming. (promote_object_alignment): Likewise. (gnat_to_gnu_field): Likewise. Rename local variable and use specific qualifier in error message for Volatile_Full_Access. * gcc-interface/trans.c (lvalue_required_p): Likewise.
2020-10-22[Ada] AI12-0211: Consistency of inherited nonoverridable aspectsSteve Baird1-0/+18
gcc/ada/ * aspects.ads: Introduce the subtype Nonoverridable_Aspect_Id, whose Static_Predicate reflects the list of nonoverridable aspects given in Ada RM 13.1.1(18.7). * sem_util.ads, sem_util.adb: Add two new visible subprograms, Check_Inherited_Nonoverridable_Aspects and Is_Confirming. The former is used to check the consistency of inherited nonoverridable aspects from multiple sources. The latter indicates whether two aspect specifications for a nonoverridable aspect are confirming. Because of compatibility concerns in compiling QGen, Is_Confirming always returns True if Relaxed_RM_Semantics (i.e., -gnatd.M) is specified. * sem_ch3.adb (Derived_Type_Declaration): Call new Check_Inherited_Nonoverridable_Aspects procedure if interface list is non-empty. * sem_ch9.adb (Check_Interfaces): Call new Check_Inherited_Nonoverridable_Aspects procedure if interface list is non-empty. * sem_ch13.adb (Analyze_Aspect_Specifications): When an explicit aspect specification overrides an inherited nonoverridable aspect, check that the explicit specification is confirming.
2020-10-22[Ada] Implement AI12-0030: Stream attribute availabilitySteve Baird1-0/+8
gcc/ada/ * sem_util.ads, sem_util.adb: Declare and implement a new predicate, Derivation_Too_Early_To_Inherit. This function indicates whether a given derived type fails to inherit a given streaming-related attribute from its parent type because the declaration of the derived type precedes the corresponding attribute_definition_clause of the parent. * exp_tss.adb (Find_Inherited_TSS): Call Derivation_Too_Early_To_Inherit instead of unconditionally assuming that a parent type's streaming attribute is available for inheritance by an immediate descendant type. * sem_attr.adb (Stream_Attribute_Available): Call Derivation_Too_Early_To_Inherit instead of unconditionally assuming that a parent type's streaming attribute is available for inheritance by an immediate descendant type. * exp_attr.adb (Default_Streaming_Unavailable): A new predicate; given a type, indicates whether predefined (as opposed to user-defined) streaming operations for the type should be implemented by raising Program_Error. (Expand_N_Attribute_Reference): For each of the 4 streaming-related attributes (i.e., Read, Write, Input, Output), after determining that no user-defined implementation is available (including a Stream_Convert pragma), call Default_Streaming_Unavailable; if that call returns True, then implement the streaming operation as "raise Program_Error;".
2020-10-22[Ada] Reimplementation of accessibility checkingJustin Squirek1-10/+26
gcc/ada/ * checks.adb (Apply_Accessibility_Check): Modify condition to avoid flawed optimization and use Get_Accessibility over Extra_Accessibility. * exp_attr.adb: Remove inclusion of Exp_Ch2.adb. * exp_ch2.adb, exp_ch2.ads (Param_Entity): Moved to sem_util. * exp_ch3.ads (Init_Proc_Level_Formal): New function. * exp_ch3.adb (Build_Init_Procedure): Add extra accessibility formal for init procs when the associated type is a limited record. (Build_Initialization_Call): Add condition to handle propagation of the new extra accessibility paramter actual needed for init procs. (Init_Proc_Level_Formal): Created to fetch a the extra accessibility parameter associated with init procs if one exists. * exp_ch4.adb (Build_Attribute_Reference): Modify static check to be dynamic. * exp_ch6.adb (Add_Cond_Expression_Extra_Actual): Move logic used to expand conditional expressions used as actuals for anonymous access formals. (Expand_Call_Helper): Remove extranious accessibility calculation logic. * exp_util.adb: Remove inclusion of Exp_Ch2.adb. * par-ch3.adb (P_Array_Type_Definition): Properly set Aliased_Present on access definitions * sem_attr.adb (Resolve_Attribute): Replace instances for Object_Access_Level with Static_Accessibility_Level. * sem_ch13.adb (Storage_Pool): Replace instances for Object_Access_Level with Static_Accessibility_Level. * sem_ch6.adb (Check_Return_Construct_Accessibility): Replace instances for Object_Access_Level with Static_Accessibility_Level. * sem_ch9.adb (Analyze_Requeue): Replace instances for Object_Access_Level with Static_Accessibility_Level. * sem_res.adb (Check_Aliased_Parameter, Check_Allocator_Discrim_Accessibility, Valid_Conversion): Replace instances for Object_Access_Level with Static_Accessibility_Level. * sem_util.adb, sem_util.ads (Accessibility_Level_Helper): Created to centralize calculation of accessibility levels. (Build_Component_Subtype): Replace instances for Object_Access_Level with Static_Accessibility_Level. (Defining_Entity): Add extra parameter to dictate whether an error is raised or empty is return in the case of an irrelevant N. (Dynamic_Accessibility_Level): Rewritten to use Accessibility_Level_Helper. (Is_View_Conversion): Check membership against Etype to capture nodes like explicit dereferences which have types but are not expanded names or identifers. (Object_Access_LeveL): Removed. (Param_Entity): Moved from sem_util. (Static_Accessibility_Level): Created as a replacement to Object_Access_Level, it also uses Accessibility_Level_Helper for its implementation. * snames.ads-tmpl: Added new name for extra accessibility parameter in init procs.
2020-10-22[Ada] AI12-0307: uniform resolution rules for aggregatesEd Schonberg1-0/+7
gcc/ada/ * sem_util.ads, sem_util.adb (Check_Ambiguous_Aggregate): When a subprogram call is found to be ambiguous, check whether ambiguity is caused by an aggregate actual. and indicate that it should carry a type qualification. * sem_ch4.adb (Traverse_Hoonyms, Try_Primitive_Operation): Call it. * sem_res.adb (Report_Ambiguous_Argument): Call it.
2020-10-21[Ada] Basic support for 128-bit typesEric Botcazou1-1/+1
gcc/ada/ * Makefile.rtl (GNATRTL_128BIT_PAIRS): New variable. (GNATRTL_128BIT_OBJS): Likewise. (Windows): In 64-bit mode, add the former to LIBGNAT_TARGET_PAIRS and the latter to EXTRA_GNATRTL_NONTASKING_OBJS. (x86_64/linux): Likewise, but unconditionally. (GNATRTL_NONTASKING_OBJS): Add s-aridou, s-exponn, s-expont, s-exponu. * ada_get_targ.adb (Get_Long_Long_Long_Size): New function. * checks.adb (Apply_Arithmetic_Overflow_Strict): Use Integer_Type_For to find an appropriate integer type; if it does not exist and the max integer size is larger than 64, use the 128-bit arithmetic routines. * cstand.adb (Create_Standard): Build Standard_Long_Long_Long_Integer and its base type. Use it for Etype of Any_Integer, Any_Modular and Any_Numeric. Use its size for Build Standard_Long_Long_Long_Unsigned and Universal_Integer. (Print_Standard): Print Long_Long_Long_Integer. * exp_attr.adb (Expand_N_Attribute_Reference) <Attribute_Mod>: Adjust comment. * exp_ch3.adb (Simple_Init_Initialize_Scalars_Type): Deal with 128-bit types. * exp_ch4.adb (Expand_Array_Comparison): Likewise. (Expand_N_Op_Expon): Likewise. (Narrow_Large_Operation): Likewise. * exp_dbug.adb (Bounds_Match_Size): Handle 128-bit size. * exp_fixd.adb (Build_Double_Divide_Code): Use RE_Double_Divide64. * exp_intr.adb (Expand_Binary_Operator_Call): Handle 128-bit size. * exp_pakd.ads (E_Array): Extend range to 127. (Bits_Id): Fill in up to 127. (Get_Id): Likewise. (GetU_Id): Likewise. (Set_Id): Likewise. (SetU_Id): Likewise. * exp_pakd.adb (Revert_Storage_Order): Handle 128-bit size. * exp_util.adb (Integer_Type_For): Likewise. (Small_Integer_Type_For): Likewise. * fname.adb (Is_Predefined_File_Name): Do not return False for names larger than 12 characters if they start with "s-". * freeze.adb (Adjust_Esize_For_Alignment): Change the maximum value to System_Max_Integer_Size. (Check_Suspicious_Modulus): Adjust comment. (Freeze_Entity): Likewise. * get_targ.ads (Get_Long_Long_Long_Size): New function. * get_targ.adb (Get_Long_Long_Long_Size): Likewise. (Width_From_Size): Deal with 128-bit size. * gnat1drv.adb (Adjust_Global_Switches): Deal with 128-bit types. * impunit.adb (Get_Kind_Of_File): Bump buffer size. Accept files with 13 characters if they start with 's'. Compare slice of Buffer. (Not_Impl_Defined_Unit): Accept files with 13 characters if they start with 's'. * krunch.ads: Document length for 128-bit support units. * krunch.adb (Krunch): Set length to 9 for 128-bit support units. * layout.adb (Layout_Type): Use System_Max_Integer_Size as alignment limit. * rtsfind.ads (RTU_Id): Add System_Arith_128, System_Compare_Array_Signed_128, System_Compare_Array_Unsigned_128, System_Exn_LLLI, System_Exp_LLLU, System_Pack_[65..127]. (RE_Id): Add RE_Integer_128, RE_Unsigned_128, RE_Add_With_Ovflo_Check128 RE_Multiply_With_Ovflo_Check128, RE_Subtract_With_Ovflo_Check128, RE_Bswap_128, RE_Compare_Array_S128, RE_Compare_Array_U128, RE_Exn_Long_Long_Long_Integer, RE_Exp_Long_Long_Long_Integer, RE_Exp_Long_Long_Long_Unsigned, RE_Bits_[65-127], RE_Get_[65-127], RE_Set_[65-127], RE_IS_Is16, RE_IS_Iu16, RE_Integer_128 and RE_Unsigned_128. Rename RE_Add_With_Ovflo_Check, RE_Double_Divide, RE_Multiply_With_Ovflo_Check, RE_Scaled_Divide and RE_Subtract_With_Ovflo_Check. Remove RE_IS_Iz1, RE_IS_Iz2, RE_IS_Iz4, RE_IS_Iz8, RE_Long_Unsigned, RE_Short_Unsigned, RE_Short_Short_Unsigned (RE_Unit_Table): Likewise. * sem_aux.adb (Corresponding_Unsigned_Type): Deal with a size equal to that of Standard_Long_Long_Long_Integer. (First_Subtype): Deal with Standard_Long_Long_Long_Integer'Base. * sem_ch13.adb (Analyze_Attribute_Definition_Clause) <Attribute_Size>: Check the size against powers of 2 and System_Max_Integer_Size for objects as well. (Set_Enum_Esize): Deal with 128-bit bounds. * sem_ch3.adb (Set_Modular_Size): Handle 128-bit size. (Modular_Type_Declaration): Deal with 128-bit types. (Signed_Integer_Type_Declaration): Support derivation from Standard_Long_Long_Long_Integer. * sem_ch4.adb (Analyze_Mod): Handle 128-bit modulus. * sem_intr.adb: Add with and use clauses for Ttypes. (Check_Shift): Handle 128-bit size and modulus. * sem_prag.adb (Analyze_Pragma) <Pragma_Initialize_Scalars>: Deal with Signed_128 and Unsigned_128. (Analyze_Integer_Value): Handle 128-bit size. * sem_util.ads (Addressable): Adjust description. * sem_util.adb (Addressable): Return true for 128 if the system supports 128 bits. (Set_Invalid_Binder_Values): Deal with Signed_128 and Unsigned_128. * set_targ.ads (Long_Long_Long_Size): New variable. * set_targ.adb (S_Long_Long_Long_Size): New constant. (DTN): Add entry for S_Long_Long_Long_Size. (DTV): Add entry for Long_Long_Long_Size. (Set_Targ): Set Long_Long_Long_Size. * snames.ads-tmpl (Name_Max_Integer_Size): New attribute name. (Name_Signed_128): New scalar name. (Name_Unsigned_128): Likewise. (Scalar_Id): Adjust. (Integer_Scalar_Id): Likewise. (Attribute_Id): Add Attribute_Max_Integer_Size. * stand.ads (Standard_Entity_Type): Add S_Long_Long_Long_Integer. (Standard_Long_Long_Long_Integer): New renaming. (Universal_Integer): Adjust description. (Standard_Long_Long_Long_Unsigned): New variable. * switch-c.adb (Scan_Front_End_Switches): Deal with -gnate128. * ttypes.ads (Standard_Long_Long_Long_Integer_Size): New variable. (Standard_Long_Long_Long_Integer_Width): Likewise. (System_Max_Integer_Size): Turn into variable. (System_Max_Binary_Modulus_Power): Likewise. * uintp.ads (Uint_127): New constant. * uintp.adb (UI_Power_2): Extednd to 128. (UI_Power_10): Likewise. (UI_Expon): Deal with exponent up to 128 specially. * usage.adb (Write_Switch_Char): Print -gnate128 switch. * libgnat/a-tifiio.adb (Put_Scaled): Call Scaled_Divide64. * libgnat/interfac__2020.ads (Integer_128): New integer type. (Unsigned_128): New modular type. (Shift_Left, Shift_Right, Shift_Right_Arithmetic, Rotate_Left, Rotate_Right): New intrinsic functions operating on it. * libgnat/s-aridou.ads, libgnat/s-aridou.adb: New generic package. * libgnat/s-arit64.ads, libgnat/s-arit64.adb: Instantiate System.Arithmetic_Double. * libgnat/s-arit128.ads, libgnat/s-arit128.adb: Likewise. * libgnat/s-bytswa.ads: Add with clause for Interfaces, use subtypes of unsigned types defined in Interfaces and add Bswap_128. * libgnat/s-casi128.ads, libgnat/s-casi128.adb: New package. * libgnat/s-caun128.ads, libgnat/s-caun128.adb: Likewise. * libgnat/s-exnint.ads: Instantiate System.Exponn. * libgnat/s-exnint.adb: Add pragma No_Body. * libgnat/s-exnlli.ads: Instantiate System.Exponn. * libgnat/s-exnlli.adb: Add pragma No_Body. * libgnat/s-exnllli.ads: Instantiate System.Exponn. * libgnat/s-expint.ads: Likewise. * libgnat/s-expint.adb: Add pragma No_Body. * libgnat/s-explli.ads: Instantiate System.Exponn. * libgnat/s-explli.adb: Add pragma No_Body. * libgnat/s-expllli.ads: Instantiate System.Exponn. * libgnat/s-explllu.ads: Instantiate System.Exponu. * libgnat/s-expllu.ads: Likewise. * libgnat/s-expllu.adb: Add pragma No_Body. * libgnat/s-exponn.ads, libgnat/s-exponn.adb: New generic function. * libgnat/s-expont.ads, libgnat/s-expont.adb: Likewise. * libgnat/s-exponu.ads, libgnat/s-exponu.adb: Likewise. * libgnat/s-expuns.ads, libgnat/s-expuns.adb: Likewise. * libgnat/s-pack65.ads, libgnat/s-pack65.adb: New package. * libgnat/s-pack66.ads, libgnat/s-pack66.adb: New package. * libgnat/s-pack67.ads, libgnat/s-pack67.adb: New package. * libgnat/s-pack68.ads, libgnat/s-pack68.adb: New package. * libgnat/s-pack69.ads, libgnat/s-pack69.adb: New package. * libgnat/s-pack70.ads, libgnat/s-pack70.adb: New package. * libgnat/s-pack71.ads, libgnat/s-pack71.adb: New package. * libgnat/s-pack72.ads, libgnat/s-pack72.adb: New package. * libgnat/s-pack73.ads, libgnat/s-pack73.adb: New package. * libgnat/s-pack74.ads, libgnat/s-pack74.adb: New package. * libgnat/s-pack75.ads, libgnat/s-pack75.adb: New package. * libgnat/s-pack76.ads, libgnat/s-pack76.adb: New package. * libgnat/s-pack77.ads, libgnat/s-pack77.adb: New package. * libgnat/s-pack78.ads, libgnat/s-pack78.adb: New package. * libgnat/s-pack79.ads, libgnat/s-pack79.adb: New package. * libgnat/s-pack80.ads, libgnat/s-pack80.adb: New package. * libgnat/s-pack81.ads, libgnat/s-pack81.adb: New package. * libgnat/s-pack82.ads, libgnat/s-pack82.adb: New package. * libgnat/s-pack83.ads, libgnat/s-pack83.adb: New package. * libgnat/s-pack84.ads, libgnat/s-pack84.adb: New package. * libgnat/s-pack85.ads, libgnat/s-pack85.adb: New package. * libgnat/s-pack86.ads, libgnat/s-pack86.adb: New package. * libgnat/s-pack87.ads, libgnat/s-pack87.adb: New package. * libgnat/s-pack88.ads, libgnat/s-pack88.adb: New package. * libgnat/s-pack89.ads, libgnat/s-pack89.adb: New package. * libgnat/s-pack90.ads, libgnat/s-pack90.adb: New package. * libgnat/s-pack91.ads, libgnat/s-pack91.adb: New package. * libgnat/s-pack92.ads, libgnat/s-pack92.adb: New package. * libgnat/s-pack93.ads, libgnat/s-pack93.adb: New package. * libgnat/s-pack94.ads, libgnat/s-pack94.adb: New package. * libgnat/s-pack95.ads, libgnat/s-pack95.adb: New package. * libgnat/s-pack96.ads, libgnat/s-pack96.adb: New package. * libgnat/s-pack97.ads, libgnat/s-pack97.adb: New package. * libgnat/s-pack98.ads, libgnat/s-pack98.adb: New package. * libgnat/s-pack99.ads, libgnat/s-pack99.adb: New package. * libgnat/s-pack100.ads, libgnat/s-pack100.adb: New package. * libgnat/s-pack101.ads, libgnat/s-pack101.adb: New package. * libgnat/s-pack102.ads, libgnat/s-pack102.adb: New package. * libgnat/s-pack103.ads, libgnat/s-pack103.adb: New package. * libgnat/s-pack104.ads, libgnat/s-pack104.adb: New package. * libgnat/s-pack105.ads, libgnat/s-pack105.adb: New package. * libgnat/s-pack106.ads, libgnat/s-pack106.adb: New package. * libgnat/s-pack107.ads, libgnat/s-pack107.adb: New package. * libgnat/s-pack108.ads, libgnat/s-pack108.adb: New package. * libgnat/s-pack109.ads, libgnat/s-pack109.adb: New package. * libgnat/s-pack110.ads, libgnat/s-pack110.adb: New package. * libgnat/s-pack111.ads, libgnat/s-pack111.adb: New package. * libgnat/s-pack112.ads, libgnat/s-pack112.adb: New package. * libgnat/s-pack113.ads, libgnat/s-pack113.adb: New package. * libgnat/s-pack114.ads, libgnat/s-pack114.adb: New package. * libgnat/s-pack115.ads, libgnat/s-pack115.adb: New package. * libgnat/s-pack116.ads, libgnat/s-pack116.adb: New package. * libgnat/s-pack117.ads, libgnat/s-pack117.adb: New package. * libgnat/s-pack118.ads, libgnat/s-pack118.adb: New package. * libgnat/s-pack119.ads, libgnat/s-pack119.adb: New package. * libgnat/s-pack120.ads, libgnat/s-pack120.adb: New package. * libgnat/s-pack121.ads, libgnat/s-pack121.adb: New package. * libgnat/s-pack122.ads, libgnat/s-pack122.adb: New package. * libgnat/s-pack123.ads, libgnat/s-pack123.adb: New package. * libgnat/s-pack124.ads, libgnat/s-pack124.adb: New package. * libgnat/s-pack125.ads, libgnat/s-pack125.adb: New package. * libgnat/s-pack126.ads, libgnat/s-pack126.adb: New package. * libgnat/s-pack127.ads, libgnat/s-pack127.adb: New package. * libgnat/s-rannum.ads (Random): New function returning 128-bit. * libgnat/s-rannum.adb (Random): Implement it. * libgnat/s-scaval.ads: Add with clause for Interfaces, use subtypes of unsigned types defined in Interfaces. * libgnat/s-scaval.adb: Add use clause for Interfaces. * libgnat/s-scaval__128.ads, libgnat/s-scaval__128.adb: New package. * libgnat/s-unstyp.ads (Long_Long_Long_Unsigned): New modular type. (Shift_Left, Shift_Right, Shift_Right_Arithmetic, Rotate_Left, Rotate_Right): New intrinsic functions operating on it. gcc/testsuite/ * gnat.dg/multfixed.adb: Update expected exception message.
2020-10-20[Ada] Refine result type of Get_AccessibilityPiotr Trojanek1-1/+1
gcc/ada/ * sem_util.ads, sem_util.adb (Get_Accessibility): Refine result type from Node_Id to Entity_Id.
2020-10-20[Ada] Implement AI12-0280 Making 'Old more flexibleSteve Baird1-1/+87
gcc/ada/ * sem_util.ads: Declare a new package, Old_Attr_Util, which in turn declares two more packages, Conditional_Evaluation and Indirect_Temps. Conditional_Evaluation provides a predicate for deciding whether a given 'Old attribute reference is eligible for conditional evaluation and, in the case where it is eligible, a function that constructs the Boolean-valued condition that is to be evaluated at run time in deciding whether to evaluate the attribute prefix. Indirect_Temps provides support for declaring a temporary which is only initialized conditionally; more specifically, an access type and a variable of that type are declared (unconditionally) and then the variable is (conditionally) initialized with an allocator. The existence of the access type and the pointer variable is hidden from clients, except that a predicate, Is_Access_Type_For_Indirect_Temp, is provided for identifying such access types. This is needed because we want such an access type to be treated like a "normal" access type (specifically with respect to finalization of allocated objects). Other parts of the compiler treat access types differently if Comes_From_Source is False, or if the secondary stack storage pool is used; this predicate is used to disable this special treatment. * sem_attr.adb (Uneval_Old_Msg): Improve message text to reflect Ada202x changes. (Analyze_Attribute): A previously-illegal 'Old attribute reference is accepted in Ada2020 if it is eligible for conditional evaluation. * sem_res.adb (Valid_Conversion): Do not treat a rewritten 'Old attribute like other rewrite substitutions. This makes a difference, for example, in the case where we are generating the expansion of a membership test of the form "Saooaaat'Old in Named_Access_Type"; in this case Valid_Conversion needs to return True (otherwise the expansion will be False - see the call site in exp_ch4.adb). * exp_attr.adb (Expand_N_Attribute_Reference): When expanding a 'Old attribute reference, test for the case where the reference is eligible for conditional evaluation. In that case, use the new "indirect temporary" mechanism provided by Sem_Util. * exp_prag.adb (Expand_Attributes_In_Consequence.Expand_Attributes): If Sem_Util.Indirect_Temp_Needed indicates that there could be correctness problems associated with the old expansion scheme for dealing with 'Old attributes in contract cases consequences, then we use the new "indirect temporary" mechanism provided by Sem_Util instead. We do not want to do this unconditionally. * sem_util.adb: Provide a body for the new Old_Attr_Util package. Further work is needed in several areas for correctness: - The function Is_Repeatedly_Evaluated does not deal with container aggregates yet. - The function Is_Known_On_Entry does not deal with interactions with the Global aspect. Each area where more work is needed is indicated with a "???" comment in the code; a more detailed description can be found there. Some optimization opportunties are similarly indicated with a "???" comment. * exp_ch3.adb (Freeze_Type): In deciding whether to generate expansion for the list controller of an access type, take the predicate Is_Access_Type_For_Indirect_Temp into account. If the predicate yields True, then generate the expansion. * exp_util.adb (Build_Allocate_Deallocate_Proc): We don't normally finalize allocated objects that are allocated on the secondary stack. Add an exception to this rule if the predicate Is_Access_Type_For_Indirect_Temp yields True. As a result of this exception, we have to deal with the fact that gigi expects a different parameter profile if we are using the secondary stack pool; the Pool and Alignment parameters must be omitted in this case.
2020-10-20[Ada] Fix comments as volatility properties can apply to objectsYannick Moy1-4/+4
gcc/ada/ * sem_util.adb, sem_util.ads: Comment fix.
2020-10-20[Ada] Support for new aspect Subprogram_Variant on recursive subprogramsPiotr Trojanek1-0/+7
gcc/ada/ * aspects.ads: Introduce Subprogram_Variant aspect with the following properties: GNAT-specific, with mandatory expression, not a representation aspect, never delayed. * contracts.adb (Expand_Subprogram_Contract): Mention new aspect in the comment. (Add_Contract_Item): Support addition of pragma Subprogram_Variant to N_Contract node. (Analyze_Entry_Or_Subprogram_Contract): Mention new aspect in the comment; add pragma Subprogram_Variant to N_Contract node. (Build_Postconditions_Procedure): Adapt call to Insert_Before_First_Source_Declaration, which is now reused in expansion of new aspect. (Process_Contract_Cases_For): Also process Subprogram_Variant, which is stored in N_Contract node together with Contract_Cases. * contracts.ads (Analyze_Entry_Or_Subprogram_Contract): Mention new aspect in the comment. (Analyze_Entry_Or_Subprogram_Body_Contract): Likewise. * einfo.adb (Get_Pragma): Support retrieval of new pragma. * einfo.ads (Get_Pragma): Likewise. * exp_ch6.adb (Check_Subprogram_Variant): New routine for emitting call to check Subprogram_Variant expressions at run time. (Expand_Call_Helper): Check Subprogram_Variant expressions at recursive calls. * exp_prag.adb (Make_Op): Moved from expansion of pragma Loop_Variant to Exp_Util, so it is now reused for expansion of pragma Subprogram_Variant. (Process_Variant): Adapt call to Make_Op after moving it to Exp_Util. (Expand_Pragma_Subprogram_Variant): New routine. * exp_prag.ads (Expand_Pragma_Subprogram_Variant): Likewise. * exp_util.adb (Make_Variant_Comparison): Moved from Exp_Prag (see above). * exp_util.ads (Make_Variant_Comparison): Likewise. * inline.adb (Remove_Aspects_And_Pragmas): Handle aspect/pragma Subprogram_Variant just like similar contracts. * par-prag.adb (Prag): Likewise. * sem.adb (Insert_Before_First_Source_Declaration): Moved from Contracts (see above). * sem.ads (Insert_Before_First_Source_Declaration): Likewise. * sem_ch12.adb: Mention new aspect in the comment about "Implementation of Generic Contracts", just like similar aspects are mentioned there. * sem_ch13.adb (Insert_Pragma): Mention new aspect in the comment, because this routine is now used for Subprogram_Variant just like for other similar aspects. (Analyze_Aspect_Specifications): Mention new aspect in comments; it is handled just like aspect Contract_Cases. (Check_Aspect_At_Freeze_Point): Do not expect aspect Subprogram_Variant just like we don't expect aspect Contract_Cases. * sem_prag.adb (Ensure_Aggregate_Form): Now also used for pragma Subprogram_Variant, so update comment. (Analyze_Pragma): Add initial checks for pragma Subprogram_Variant. (Analyze_Subprogram_Variant_In_Decl_Part): New routine with secondary checks on the new pragma. (Sig_Flags): Handle references within pragma Subprogram_Variant expression just like references in similar pragma Contract_Cases. (Is_Valid_Assertion_Kind): Handle Subprogram_Variant just like other similar contracts. * sem_prag.ads (Analyze_Subprogram_Variant_In_Decl_Part): New routine. * sem_res.adb (Same_Or_Aliased_Subprograms): Moved to Sem_Util, so it can be reused for detection of recursive calls where Subprogram_Variant needs to be verified. * sem_util.adb (Is_Subprogram_Contract_Annotation): Handle new Subprogram_Variant annotation just like other similar annotations. (Same_Or_Aliased_Subprograms): Moved from Sem_Res (see above). * sem_util.ads (Is_Subprogram_Contract_Annotation): Mention new aspect in the comment. (Same_Or_Aliased_Subprograms): Moved from Sem_Res (see above). * sinfo.ads (N_Contract): Document handling of Subprogram_Variant. * snames.ads-tmpl: Add name for the internally generated procedure with checks for Subprogram_Variant expression, name for the new aspect and new pragma corresponding to aspect Subprogram_Variant.
2020-10-19[Ada] Expanded names in ghost assignmentsBob Duff1-0/+3
gcc/ada/ * ghost.adb (Whole_Object_Ref): New function to compute the name of the whole object. (Mark_And_Set_Ghost_Assignment): Rewrite to use Whole_Object_Ref. We need to partly analyze the left-hand side in order to distinguish expanded names and record components. * lib-xref.ads, lib-xref.adb (Deferred_References): Move table to body, and add Defer_Reference to update the table, avoiding duplicates. (Generate_Reference): Avoid duplicates. * sem_ch8.ads, sem_ch8.adb (Find_Direct_Name): Remove _OK parameters, which are no longer needed. Ignore errors in Ignore_Errors mode. * sem_util.ads, sem_util.adb (Preanalyze_Without_Errors): Make this public, so we can call it from Ghost. * errout.ads, scng.adb, sem_prag.adb: Minor.
2020-10-16[Ada] Constants no longer synchronised if they are access-to-variableChris Martin1-1/+4
gcc/ada/ * sem_util.ads, sem_util.adb (Is_Access_Variable): New function. (Is_Synchronized_Object): Call new function when determining if a constant can be regarded as synchronized.
2020-10-16[Ada] Detect qualified type names for AI12-0027Piotr Trojanek1-1/+1
gcc/ada/ * sem_util.adb (Is_View_Conversion): Detect qualified types. * sem_util.ads (Is_Actual_In_Out_Parameter): Fix style in comment.
2020-10-16[Ada] SPARK: update for effectively volatile types and objectsYannick Moy1-3/+24
gcc/ada/ * sem_prag.adb (Analyze_Global_In_Decl_Part): Update check to reject volatile object for reading. * sem_res.adb (Resolve_Actuals, Resolve_Entity_Name): Update check to reject volatile object for reading. * sem_util.adb, sem_util.ads (Check_Nonvolatile_Function_Profile, Has_Effectively_Volatile_Profile): Detect use of volatile object for reading. (Has_Enabled_Property): Accept constants as well. (Is_Effectively_Volatile_For_Reading): New function based on existing Is_Effectively_Volatile. (Is_Effectively_Volatile_Object_For_Reading): Adapted from the existing Is_Effectively_Volatile_Object, using a shared implementation in Is_Effectively_Volatile_Object_Shared.
2020-09-03Look at fullest view when checking for static types in unnestingArnaud Charlet1-0/+6
When seeing if any bound involved in a type is an uplevel reference, we must look at the fullest view of a type, since that's what the backends will do. Similarly for private types. We introduce Get_Fullest_View for that purpose. * sem_util.ads, sem_util.adb (Get_Fullest_View): New procedure. * exp_unst.adb (Check Static_Type): Do all processing on fullest view of specified type.
2020-07-27[Ada] Ada2020: AI12-0027 Access values and unaliased componentJavier Miranda1-0/+10
gcc/ada/ * sem_res.adb (Resolve_Actuals): Restrict the check on matching aliased components to view conversions of array types that are not placed in an instance. In such case at runtime an object is created. * sem_util.ads (Is_Actual_In_Out_Parameter, Is_View_Conversion): New subprograms. * sem_util.adb (Is_Actual_In_Out_Parameter, Is_View_Conversion): New subprograms.
2020-07-16[Ada] Ada2020: AI12-0107 convention of By_Protected_ProcedureJavier Miranda1-0/+4
gcc/ada/ * exp_attr.adb (Has_By_Protected_Procedure_Prefixed_View): New subprogram. (Expand_Access_To_Protected_Op): Adding support for prefixed class-wide view with By_Protected_Procedure convention. * sem_attr.adb (Get_Convention): New subprogram. (Get_Kind): Adapted to use Get_Convention. * sem_ch4.adb (Try_By_Protected_Procedure_Prefixed_View): New subprogram. (Analyze_Selected_Component): Invoke Try_By_Protected_Procedure_Prefixed_View. * sem_util.ads (Is_By_Protected_Procedure): New subprogram. * sem_util.adb (Is_By_Protected_Procedure): New subprogram.
2020-07-15[Ada] Extend static functionsArnaud Charlet1-6/+6
gcc/ada/ * inline.adb, inline.ads (Inline_Static_Expression_Function_Call): Renamed Inline_Static_Function_Call. * sem_ch13.adb (Analyze_Aspect_Static): Allow static intrinsic imported functions under -gnatX. * sem_util.ads, sem_util.adb (Is_Static_Expression_Function): Renamed Is_Static_Function. (Is_Static_Expression_Function_Call): Renamed Is_Static_Function_Call. * sem_ch6.adb, sem_elab.adb, sem_res.adb: Update calls to Is_Static_Function*. * sem_eval.adb (Fold_Dummy, Eval_Intrinsic_Call, Fold_Shift): New. (Eval_Call): Add support for intrinsic calls, code refactoring. (Eval_Entity_Name): Code refactoring. (Eval_Logical_Op): Update comment. (Eval_Shift): Call Fold_Shift. Update comments. * par-prag.adb (Par [Pragma_Extensions_Allowed]): Set Ada_Version to Ada_Version_Type'Last to handle Extensions_Allowed (On) consistently. * opt.ads (Extensions_Allowed): Update documentation. * sem_attr.adb: Update comment. * doc/gnat_rm/implementation_defined_pragmas.rst: Update documentation of Extensions_Allowed. * gnat_rm.texi: Regenerate.
2020-07-10[Ada] Use small limit for aggregates inside subprogramsArnaud Charlet1-0/+5
gcc/ada/ * exp_aggr.adb (Max_Aggregate_Size): Use small limit for aggregate inside subprograms. * sprint.adb (Sprint_Node_Actual [N_Object_Declaration]): Do not print the initialization expression if the No_Initialization flag is set. * sem_util.ads, sem_util.adb (Predicate_Enabled): New. * exp_ch4.adb (Expand_N_Type_Conversion): Code cleanup and apply predicate check consistently. * exp_ch6.adb (Expand_Actuals.By_Ref_Predicate_Check): Ditto. * sem_ch3.adb (Analyze_Object_Declaration): Ditto. * exp_ch3.adb (Build_Assignment): Revert handling of predicate check for allocators with qualified expressions, now handled in Freeze_Expression directly. * sem_aggr.adb: Fix typos. * checks.adb: Code refactoring: use Predicate_Enabled. (Apply_Predicate_Check): Code cleanup. * freeze.adb (Freeze_Expression): Freeze the subtype mark before a qualified expression on an allocator. * exp_util.ads, exp_util.adb (Within_Internal_Subprogram): Renamed Predicate_Check_In_Scope to clarify usage, refine handling of predicates within init procs which should be enabled when the node comes from source. * sem_ch13.adb (Freeze_Entity_Checks): Update call to Predicate_Check_In_Scope.
2020-07-08[Ada] Accept aspect Relaxed_Initialization on generic subprogramsPiotr Trojanek1-1/+1
gcc/ada/ * sem_attr.adb (Analyze_Attribute): Correct prefix of 'Result this prefix is a generic function but the enclosing aspect or pragma is attached to its instance. * sem_ch12.adb (Analyze_Generic_Subprogram_Declaration): Analyze generic subprogram formal parameters (including the implicit result of a generic function) and only then analyse its aspects, because with Relaxed_Initialization the aspect expression might refer to those formal parameters. * sem_ch13.adb (Analyze_Aspect_Relaxed_Initialization): Accept aspect on generic subprograms; install formal parameters of a generic subprogram but not formal parameters of the generic unit itself (the previous code was inspired by aspects Post and Depends, where both kinds of formals are allowed). * sem_util.ads (Enter_Name): Fix name of a subprogram referenced in comment.
2020-07-08[Ada] ACATS 4.1R - BD10001 - Error missedArnaud Charlet1-1/+1
gcc/ada/ * sem_prag.adb (Process_Inline): Check for duplicate pragma+aspect Inline. Minor code cleanup. (Check_Duplicate_Pragma): Add warning for duplicate pragma [No_]Inline under -gnatwr. * sinfo.ads, sinfo.adb (Next_Rep_Item): Allow N_Null_Statement which can appear when a pragma is rewritten. * sem_util.ads, sem_util.adb, bindo-writers.adb: Fix bad copy/paste now flagged. * libgnat/s-mmap.ads: Remove redundant pragma Inline.
2020-07-08[Ada] Add utility function to recognize attribute 'Loop_EntryYannick Moy1-0/+3
gcc/ada/ * sem_util.ads, sem_util.adb (Is_Attribute_Loop_Entry): New function for GNATProve.
2020-07-08[Ada] Remove excessive validity checks on in-parametersPiotr Trojanek1-7/+8
gcc/ada/ * sem_util.ads, sem_util.adb (Safe_To_Capture_Value): Return True for in-parameters.
2020-07-08[Ada] Allow boolean expressions in aspect Relaxed_InitializationPiotr Trojanek1-3/+3
gcc/ada/ * sem_ch13.adb (Analyze_Aspect_Relaxed_Initialization): Analyze optional boolean expressions. * sem_util.ads, sem_util.adb (Has_Relaxed_Initialization): Adapt query; update comment.
2020-07-07[Ada] Ada2020: AI12-0198 potentially unevaluated components of arraysJavier Miranda1-5/+5
gcc/ada/ * sem_util.ads (Interval_Lists): Reordering routine. * sem_util.adb (Interval_Lists): Reordering routines to keep them alphabetically ordered.
2020-07-06[Ada] Ada2020: AI12-0198 potentially unevaluated array componentsJavier Miranda1-0/+10
gcc/ada/ * sem_util.ads (Interval_Lists.Aggregate_Intervals): New subprogram. * sem_util.adb (Has_Null_Others_Choice, Non_Static_Or_Null_Range, Interval_Lists.Aggregate_Intervals): New subprograms. (Is_Potentially_Unevaluated): Adding support to detect potentially unevaluated components of array aggregates.
2020-07-06[Ada] Predicates and the current instance of a subtype (AI12-0068)Gary Dismukes1-0/+7
gcc/ada/ * sem_attr.adb (Analyze_Attribute, Attribute_Constrained): Issue a warning if the attribute prefix is a current instance reference within an aspect of a type or subtype. (Address_Checks): Replace test of Is_Object (Ent) with Is_Object_Reference (P) so that testing for current instances will be done. (Eval_Attribute): Add test for current instance reference, to ensure that we still fold array attributes when current instances are involved, since value prefixes are allowed for array attributes, and will now be excluded by Is_Object_Reference. * sem_util.ads (Is_Current_Instance_Reference_In_Type_Aspect): New exported query function. * sem_util.adb (Is_Object_Reference): Return False for the case where N is a current instance reference within an aspect_specification of a type or subtype (basically if the reference occurs within a predicate, invariant, or DIC aspect expression). (Is_Current_Instance_Reference_In_Type_Aspect): New function that tests whether a node is a reference to a current instance formal of a predicate, invariant, or Default_Initial_Condition (DIC) subprogram.
2020-06-19[Ada] Add comments about attribute 'Valid_Scalars on private tagged typesPiotr Trojanek1-4/+4
2020-06-19 Piotr Trojanek <trojanek@adacore.com> gcc/ada/ * exp_attr.adb (Expand_N_Attribute_Reference): Add comment. * sem_attr.adb (Analyze_Attribute): Add ??? comment. * sem_util.ads (Valid_Scalars): This routine is only used for 'Valid_Scalars and not for 'Valid.
2020-06-17[Ada] Support aspect Relaxed_Initialization on private types and constantsPiotr Trojanek1-3/+4
2020-06-17 Piotr Trojanek <trojanek@adacore.com> gcc/ada/ * einfo.adb (Is_Relaxed_Initialization_State): Add reference to SPARK RM. * sem_attr.adb (Analyze_Attribute_Old_Result): Likewise. * sem_ch13.adb (Analyze_Aspect_Relaxed_Initialization): Reject aspect on completions of private types and deferred constants. * sem_util.ads, sem_util.adb (Has_Relaxed_Initialization): Adjust comments; support queries for constants.
2020-06-17[Ada] Fix comment of Get_Iterable_Type_PrimitivePiotr Trojanek1-2/+2
2020-06-17 Piotr Trojanek <trojanek@adacore.com> gcc/ada/ * sem_util.ads, sem_util.adb (Get_Iterable_Type_Primitive): Fix comment and enforce it with an assertion in the body.
2020-06-17[Ada] Implement static expression functions for Ada 202x (AI12-0075)Gary Dismukes1-0/+9
2020-06-17 Gary Dismukes <dismukes@adacore.com> gcc/ada/ * aspects.ads (type Aspect_Id): Add Aspect_Static as a Boolean aspect, and update the Is_Representation_Aspect, Aspect_Names, and Aspect_Delay arrays. * exp_ch6.adb (Expand_Simple_Function_Return): In the case of a return for a static expression function, capture a copy of the expression of the return statement before it's expanded and reset its Analyzed flags. Then, just before leaving this procedure, if the expression was rewritten, set the Original_Node of the rewritten expression to the new copy and also set the Expression of the associated static expression function to designate that copy. This ensures that later copies of the expression made via New_Copy_Tree will fully copy all nodes of the expression tree. * inline.ads (Inline_Static_Expression_Function_Call): New procedure to evaluate and produce the result of a static call to a static expression function. * inline.adb: Add with and use for Sem_Res. (Establish_Actual_Mapping_For_Inlined_Call): New procedure extracted from code in Expand_Inlined_Call that traverses the actuals and formals of an inlined call and in some cases creates temporaries for holding the actuals, plus establishes an association between formals and actuals (via the Renamed_Object fields of the formals). (Formal_Is_Used_Once): Function removed from Expand_Inlined_Call and now nested in the above procedure. (Expand_Inlined_Call): Code for doing the formal/actual traversal is moved to Create_Actual_Temporaries and replaced with a call to that new procedure. (Inline_Static_Expression_Function_Call): New procedure to evaluate a static call to a static expression function, substituting actuals for their corresponding formals and producing a fully folded and static result expression. The function has subsidiary functions Replace_Formal and Reset_Sloc that take care of doing the mapping of formals to actuals and resetting the Slocs of subnodes of the mapped expression to that of the call so errors will be flagged on the call rather than function. * sem_ch6.adb (Analyze_Expression_Function): In the case of a static expression function, perform an additional preanalysis of the function's expression to ensure that it's a potentially static expression (according to the requirements of 6.8(3.2/5-3.4/5)), and issue an error if it's not. The global flag Checking_Potentially_Static_Expression is set and unset around this checking. * sem_ch13.adb (Analyze_Aspect_Static): New procedure to enforce selected requirements of the new aspect Static on expression functions, including checking that the language version is Ada_2020 and that the entity to which it applies is an expression function whose formal parameters are of a static subtype and have mode 'in', its result subtype is a static subtype, and it has no pre- or postcondition aspects. A ??? comment is added to indicate the need for adding checking that type invariants don't apply to the result type if the function is a boundary entity. (Analyze_One_Aspect): Call Analyze_Aspect_Static for aspect Static. * sem_elab.adb (Build_Call_Marker): Return without creating a call marker when the subprogram is a static expression function, since no ABE checking is needed for such functions. * sem_eval.ads (Checking_Potentially_Static_Expression): New function to return whether the checking for potentially static expressions is enabled. (Set_Checking_Potentially_Static_Expression): New procedure to enable or disable checking of potentially static expressions. * sem_eval.adb (Checking_For_Potentially_Static_Expression): New global flag for determining whether preanalysis of potentially static expression is being done, which affects the behavior of certain static evaluation routines. (Checking_Potentially_Static_Expression): New function to return whether the checking for potentially static expressions is enabled. (Eval_Call): When evaluating a call within a static expression function with checking of potentially static expression functions enabled, substitutes a static value in place of the call to allow folding of the expression. (Eval_Entity_Name): When evaluating a formal parameter of a static expression function with checking of potentially static expression functions enabled, substitutes a static value in place of the reference to the formal to allow folding of the expression. (Set_Checking_Potentially_Static_Expression): New procedure to enable or disable checking of potentially static expressions. * sem_res.adb (Resolve_Call): Test for a recursive call occurring within a static expression function and issue an error for such a call. Prevent the establishment of a transient scope in the case this is a call to a (string-returning) static expression function. When calling a static expression function, if no error has been posted on the function, call Inline_Static_Expression_Function_Call to convert the call into its equivalent static value. * sem_util.ads (Is_Static_Expression_Function): New function returning whether the subprogram entity passed to it is a static expression function. (Is_Static_Expression_Function_Call): New function to determine whether the call node passed to it is a static call to a static expression function. * sem_util.adb (Compile_Time_Constraint_Error): Suppress compile-time Constraint_Error reporting when checking for a potentially static expression. (Is_Static_Expression_Function): New function returning whether the subprogram entity passed to it is a static expression function by testing for the presence of aspect Static. (Has_All_Static_Actuals): New function in Is_Static_Expression_Function_Call that traverses the actual parameters of a function call and returns True only when all of the actuals are given by static expressions. In the case of a string-returning function, we call Resolve on each actual to ensure that their Is_Static_Expression flag properly reflects whether they're static, to allow suppressing creation of a transient scope within Resolve_Call. A prominent ??? comment is added to explain this rather unconventional call to Resolve. (Is_Static_Expression_Function_Call): New function that determines whether a node passed to it is a call to a static expression function all of whose actual parameters are given by static expressions.
2020-06-16[Ada] Implement AI12-0249, AI12-0295 (user-defined numeric & string literals)Steve Baird1-0/+4
2020-06-16 Steve Baird <baird@adacore.com> gcc/ada/ * snames.ads-tmpl: Define names of the three new aspects. * aspects.ads: Define the three new aspects. * sem_util.ads, sem_util.adb, sem_dim.adb: Move the function String_From_Numeric_Literal from being declared in the body of package Sem_Dim to being declared in the visible part of package Sem_Util. * sem_ch13.ads, sem_ch13.adb: Declare new visible procedure Validate_Literal_Aspect. This is where most of the legality checking occurs for an aspect specification for one of the three new aspects, as well as resolution of the subprogram named in the aspect specification. Follow example of other aspects (e.g., Validate_Literal_Aspect is called in much the same way as Validate_Iterable_Aspect in Analyze_Aspects_At_Freeze_Point; a small amount of legality checking is performed in Analyze_One_Aspect in much the same way as for Default_Value or Default_Component_Value aspects). Most of the work is done in Validate_Literal_Aspect. * contracts.adb (Add_Contract_Item): Call Validate_Literal_Aspect in much the same way that Validate_Iterable_Aspect was already being called. * sem_res.adb (Resolve): Rewrite a literal as a call if it is a user-defined literal. This is where the dynamic semantics of the 3 new aspects are implemented. * sem_ch6.adb (Fully_Conformant_Expressions): Two numeric literals that have different text but the same value (e.g., 12345 and 12_345) do not conform if they are user-defined literals. Introduce a new function User_Defined_Numeric_Literal_Mismatch to avoid duplication in making this check. * sem_type.adb (Has_Compatible_Type): A numeric literal can be compatible with a non-numeric type (and a string literal can be compatible with a non-string type) if it can be interpreted as a user-defined literal.
2020-06-15[Ada] Crash in tagged type constructor with task componentsJavier Miranda1-2/+3
2020-06-15 Javier Miranda <miranda@adacore.com> gcc/ada/ * restrict.ads (Set_Global_No_Tasking, Global_No_Tasking): New subprograms. * restrict.adb (Set_Global_No_Tasking, Global_No_Tasking): New subprograms. * sem_ch3.adb (Access_Definition): Do not skip building masters since they may be required for BIP calls. (Analyze_Subtype_Declaration): Propagate attribute Is_Limited_Record in class-wide subtypes and subtypes with cloned subtype attribute; propagate attribute Is_Limited_Interface. * sem_ch6.adb (Check_Anonymous_Return): Do not skip building masters since they may be required for BIP calls. Use Build_Master_Declaration to declare the _master variable. (Create_Extra_Formals): Add decoration of Has_Master_Entity when the _master formal is added. * exp_ch3.adb (Init_Formals): Adding formal to decorate it with attribute Has_Master_Entity when the _master formal is added. (Build_Master): Do not skip building masters since they may be required for BIP calls. (Expand_N_Object_Declaration): Ensure activation chain and master entity for objects initialized with BIP function calls. * sem_prag.adb (Process_Restrictions_Or_Restriction_Warnings): Adding support to detect and save restriction No_Tasking when set in the run-time package System or in a global configuration pragmas file. * sem_util.adb (Current_Entity_In_Scope): Overload this subprogram to allow searching for an entity by its Name. * sem_util.ads (Current_Entity_In_Scope): Update comment. * exp_ch4.adb (Expand_N_Allocator): Do not skip building masters since they may be required for BIP calls. * exp_ch6.ads (Might_Have_Tasks): New subprogram. * exp_ch6.adb (Make_Build_In_Place_Call_In_Allocator): Add support for BIP calls returning objects that may have tasks. (Make_Build_In_Place_Call_In_Allocator): Build the activation chain if the result might have tasks. (Make_Build_In_Place_Iface_Call_In_Allocator): Build the class wide master for the result type. (Might_Have_Tasks): New subprogram. (Needs_BIP_Task_Actuals): Returns False when restriction No_Tasking is globally set. * exp_ch9.ads (Build_Master_Declaration): New subprogram. * exp_ch9.adb (Build_Activation_Chain_Entity): No action performed when restriction No_Tasking is globally set. (Build_Class_Wide_Master): No action performed when restriction No_Tasking is globally set; use Build_Master_Declaration to declare the _master variable. (Build_Master_Declaration): New subprogram. (Build_Master_Entity): No action performed when restriction No_Tasking is globally set; added support to handle transient scopes and _finalizer routines. (Build_Master_Renaming): No action performed when restriction No_Tasking is globally set. (Build_Task_Activation_Call): Skip generating the call when the chain is an ignored ghost entity. (Find_Master_Scope): Generalize the code that detects transient scopes with master entity. * einfo.ads (Has_Nested_Subprogram): Minor comment reformatting.
2020-06-15[Ada] Bad access checks on if/case expression as actualJustin Squirek1-0/+4
2020-06-15 Justin Squirek <squirek@adacore.com> gcc/ada/ * exp_ch4.adb (Expand_N_Case_Expression): Set default value for Target to silence potential warnings. (Expand_N_If_Expression): Add calculation to check when the if expression is used directly in the context of an actual of an anonymous access type and add a special path to force expansion of the if expression in this case. * exp_ch6.adb (Expand_Branch): Generate an assignment to the level temporary for a given branch. (Expand_Call_Helper): Add expansion to allow for creating a temporary to store associated accessiblity levels on each branch of the conditional expression. Also perform expansion of function calls into expressions with actions, and fixup references to N with Call_Node. (Insert_Level_Assign): Move through nested conditional expressions to each branch. * sem_util.ads, sem_util.adb (Is_Anonymous_Access_Actual): Added to detect when to force expansion of if expressions.
2020-06-15[Ada] Support aspect Relaxed_Initialization and attribute InitializedPiotr Trojanek1-0/+5
2020-06-15 Piotr Trojanek <trojanek@adacore.com> gcc/ada/ * aspects.ads (Aspect_Id): Add Aspect_Relaxed_Initialization. (Implementation_Defined_Aspect): Add new aspect. (Aspect_Argument): Add new aspect with Optional_Expression argument. (Is_Representation_Aspect): Add new aspect as a non-representation one. (Aspect_Names): Add name for the new aspect. (Aspect_Delay): Add new aspect as a non-delayed one. * sem_ch3.adb: Minor reformatting. * einfo.ads, einfo.adb (Is_Relaxed_Initialization_State): New query; reuses existing code for querying abstract state options. * exp_attr.adb (Expand_N_Attribute_Reference): For now ignore attribute 'Initialized. * sem_attr.adb (Analyze_Attribute_Old_Result): Allow attribute 'Result to be used in the aspect Relaxed_Initialization expression. (Analyze_Attribute): Analyze attribute 'Initialized; based on existing code for attribute 'Valid_Scalars. (Eval_Attribute): Do not expect attribute 'Initialized, just like attribute 'Valid_Scalars is not expected. * sem_ch13.adb (Analyze_Aspect_Relaxed_Initialization): New routine. (Analyze_Aspect_Specifications): Analyze new aspect in a dedicated routine. (Check_Aspect_At_Freeze_Point): Do not expect new aspect. * sem_prag.adb (Analyze_Abstract_State): Support option Relaxed_Initialization on abstract states. * sem_util.ads, sem_util.adb (Has_Relaxed_Initialization): New query for the GNATprove backend. * snames.ads-tmpl (Snames): Add Name_Ids for the new aspect and attribute; add an Attribute_Id for the new attribute.
2020-06-15[Ada] Remove unreferenced and dubious Is_Renaming_DeclarationPiotr Trojanek1-3/+0
2020-06-15 Piotr Trojanek <trojanek@adacore.com> gcc/ada/ * sem_util.ads, sem_util.adb (Is_Renaming_Declaration): Remove.
2020-06-12[Ada] Implement AI12-0369Steve Baird1-0/+9
2020-06-12 Steve Baird <baird@adacore.com> gcc/ada/ * sem_util.ads, sem_util.adb: Define 3 new Boolean-valued functions - Statically_Denotes_Entity, Statically_Denotes_Object, and Statically_Names_Object. The first two were taken from sem_attr.adb. The term "statically names" is defined in the Ada RM and the new function Statically_Names_Object is intended to reflect that definition, or more precisely, as described in a comment in the code, to reflect the expected future definition of that term. * sem_attr.adb: Delete functions Statically_Denotes_Object and Statically_Denotes_Entity; these two functions have been moved to package Sem_Util. Replace call to Statically_Denotes_Object with a call to Statically_Names_Object as per AI12-0217 (a binding interpretation, so no Ada_Version check). * exp_ch9.adb (Expand_Entry_Barrier.Is_Simple_Barrier): Change name of function (it was previously Is_Simple_Barrier_Name) because the function should return True in the case of a static expression; implement this requirement. Change function to include a call to Statically_Names_Object so that, for Ada_2020 and later, it will return True for appropriate subcomponent names. (Expand_Entry_Barrier.Is_Pure_Barrier): Handle N_Indexed_Component and N_Selected_Component cases by calling Statically_Names_Object. (Expand_Entry_Barrier): Reorganize to treat Simple_Barriers and Pure_Barriers more uniformly. Prevent cascaded errors.
2020-06-11[Ada] Update SPARK RM rule numbers after removing a redundant rulePiotr Trojanek1-1/+1
2020-06-11 Piotr Trojanek <trojanek@adacore.com> gcc/ada/ * sem_ch4.adb, sem_ch6.adb, sem_res.adb, sem_util.ads: Fix references to SPARK RM 7.1.3 rule numbers.
2020-06-11[Ada] Allow specifying volatility refinement aspects for typesSteve Baird1-12/+21
2020-06-11 Steve Baird <baird@adacore.com> gcc/ada/ * contracts.adb (Add_Contract_Item): Support specifying volatility refinement aspects for types. (Analyze_Contracts): Add call to Analyze_Type_Contract in the case of a contract for a type. (Freeze_Contracts): Add call to Analyze_Type_Contract in the case of a contract for a type. (Check_Type_Or_Object_External_Properties): A new procedure which performs the work that needs to be done for both object declarations and types. (Analyze_Object_Contract): Add a call to Check_Type_Or_Object_External_Properties and remove the code in this procedure which did much of the work that is now performed by that call. (Analyze_Type_Contract): Implement this new routine as nothing more than a call to Check_Type_Or_Object_External_Properties. * contracts.ads: Update comment for Add_Contract_To_Item because types can have contracts. Follow (questionable) precedent and declare new routine Analyze_Type_Contract as visible (following example of Analyze_Object_Contract), despite the fact that it is never called from outside of the package where it is declared. * einfo.adb (Contract, Set_Contract): Id argument can be a type; support this case. (Write_Field34_Name): Field name is "contract" for a type. * einfo.ads: Update comment describing Contract attribute. * sem_ch3.adb (Build_Derived_Numeric_Type): Is_Volatile should return same answer for all subtypes of a given type. Thus, when building the base type for something like type Volatile_1_To_10 is range 1 .. 10 with Volatile; that basetype should be marked as being volatile. (Access_Type_Declaration): Add SPARK-specific legality check that the designated type of an access type shall be compatible with respect to volatility with the access type. * sem_ch12.adb (Check_Shared_Variable_Control_Aspects): Add SPARK-specific legality check that an actual type parameter in an instantiation shall be compatible with respect to volatility with the corresponding formal type. * sem_ch13.adb (Analyze_Aspect_Specifications): Perform checks for aspect specs for the 4 volatility refinement aspects that were already being performed for all language-defined aspects. * sem_prag.adb (Analyze_External_Property_In_Decl_Part, Analyze_Pragma): External properties (other than No_Caching) may be specified for a type, including a generic formal type. * sem_util.ads: Declare new subprograms - Async_Readers_Enabled, Async_Writers_Enabled, Effective_Reads, Effective_Writes, and Check_Volatility_Compatibility. * sem_util.adb (Async_Readers_Enabled, Async_Writers_Enabled, Effective_Reads, Effective_Writes): Initial implementation of new functions for querying aspect values. (Check_Volatility_Compatibility): New procedure intended for use in checking all SPARK legality rules of the form "<> shall be compatible with respect to volatility with <>". (Has_Enabled_Property): Update comment because Item_Id can be a type. Change name of nested Variable_Has_Enabled_Property function to Type_Or_Variable_Has_Enabled_Property; add a parameter to that function because recursion may be needed, e.g., in the case of a derived typ). Cope with the case where the argument to Has_Enabled_Property is a type.
2020-06-11[Ada] Move duplicated routines for building itypes to Sem_UtilPiotr Trojanek1-8/+49
2020-06-11 Piotr Trojanek <trojanek@adacore.com> gcc/ada/ * sem_aggr.adb (Build_Constrained_Itype): Move to Sem_Util. * sem_ch3.adb (Build_Subtype, Inherit_Predicate_Flags): Move... * sem_util.adb (Build_Subtype): Here. Add parameters for references to objects previously declared in enclosing scopes. (Inherit_Predicate_Flags): And here, because it is called by Build_Subtype. * sem_util.ads (Build_Overriding_Spec): Reorder alphabetically. (Build_Subtype): Moved from Sem_Ch3; comments updated. (Build_Constrained_Itype): Moved from Sem_Aggr; comments updated.
2020-06-11[Ada] Consolidate handling of implicit dereferences into semantic analysisEric Botcazou1-0/+5
2020-06-11 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * checks.adb (Build_Discriminant_Checks): Build an explicit dereference when the type is an access type. * exp_atag.adb (Build_CW_Membership): Add explicit dereferences. (Build_Get_Access_Level): Likewise. (Build_Get_Alignment): Likewise. (Build_Inherit_Prims): Likewise. (Build_Get_Transportable): Likewise. (Build_Set_Size_Function): Likewise. * exp_ch3.adb (Build_Offset_To_Top_Function): Likewise. * exp_ch4.adb (Expand_Allocator_Expression): Likewise. (Expand_N_Indexed_Component ): Remove code dealing with implicit dereferences. (Expand_N_Selected_Component): Likewise. (Expand_N_Slice): Likewise. * exp_ch9.adb (Add_Formal_Renamings): Add explicit dereference. (Expand_Accept_Declarations): Likewise. (Build_Simple_Entry_Call): Remove code dealing with implicit dereferences. (Expand_N_Requeue_Statement): Likewise. * exp_disp.adb (Expand_Dispatching_Call): Build an explicit dereference when the controlling type is an access type. * exp_spark.adb (Expand_SPARK_N_Selected_Component): Delete. (Expand_SPARK_N_Slice_Or_Indexed_Component): Likewise. (Expand_SPARK): Do not call them. * sem_ch4.adb (Process_Implicit_Dereference_Prefix): Delete. (Process_Indexed_Component): Call Implicitly_Designated_Type to get the designated type for an implicit dereference. (Analyze_Overloaded_Selected_Component): Do not insert an explicit dereference here. (Analyze_Selected_Component): Likewise. (Analyze_Slice): Call Implicitly_Designated_Type to get the designated type for an implicit dereference. * sem_ch8.adb (Has_Components): New predicate extracted from... (Is_Appropriate_For_Record): ...this. Delete. (Is_Appropriate_For_Entry_Prefix): Likewise. (Analyze_Renamed_Entry): Deal with implicit dereferences. (Find_Selected_Component): Do not insert an explicit dereference here. Call Implicitly_Designated_Type to get the designated type for an implicit dereference. Call Has_Components, Is_Task_Type and Is_Protected_Type directly. Adjust test for error. * sem_res.adb (Resolve_Implicit_Dereference): New procedure. (Resolve_Call): Call Resolve_Indexed_Component last. (Resolve_Entry): Call Resolve_Implicit_Dereference on the prefix. (Resolve_Indexed_Component): Call Implicitly_Designated_Type to get the designated type for an implicit dereference and Resolve_Implicit_Dereference on the prefix at the end. (Resolve_Selected_Component): Likewise. (Resolve_Slice): Likewise. Do not apply access checks here. * sem_util.ads (Implicitly_Designated_Type): Declare. * sem_util.adb (Copy_And_Maybe_Dereference): Simplify. (Implicitly_Designated_Type): New function. (Object_Access_Level): Fix typo. * sem_warn.adb (Check_Unset_Reference): Test Comes_From_Source on the original node.
2020-06-11[Ada] Crash on dispatching conditional entry callJavier Miranda1-0/+10
2020-06-11 Javier Miranda <miranda@adacore.com> gcc/ada/ * exp_ch9.adb (Expand_N_Conditional_Entry_Call): Replace call to New_Copy_List by calls to the new routine New_Copy_Separate_List. * sem_util.ads (New_Copy_Separate_List, New_Copy_Separate_Tree): New routines. * sem_util.adb (New_Copy_Separate_List, New_Copy_Separate_Tree): New routines. (New_Copy_Tree): Extend the machinery that detects syntactic nodes to handle lists of indentifiers with field More_Ids; otherwise such nodes are erroneously handled as semantic nodes. Copy aspect specifications attached to nodes. * sem_ch12.adb (Copy_Generic_Node): Protect reading attribute Etype.
2020-06-10[Ada] Ada_2020 AI12-0220: Pre/Postconditions on Access_To_Subprogram typesEd Schonberg1-0/+4
2020-06-10 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * einfo.ads (Access_Subprogram_Wrapper): New attribute of Subprogram_Type entities. Denotes subprogram constructed for Access_To_Subprogram types that include pre- and postconditions. * einfo.adb: Subprogram bodies for Access_Subprogram_Wrapper. * exp_ch6.adb (Expand_Call): An indirect call through an Access_To_subprogram that includes contracts is rewritten as a call to the corresponding Access_ ubprogram_Wrapper. Handle derived types that inherit contract from parent. * sem_prag.adb (Build_Access_Subprogram_Wrapper): Build subprogram declaration for subprogram that incorporates the contracts of an Access_To_Subprogram type declaration. Build corresponding body and attach it to freeze actions for type. * sem_util.ads, sem_util.adb (Is_Access_Subprogram_Wrapper): Utility that uses signature of the subprogram to determine whether it is a generated wrapper for an Access_To_Subprogram type.
2020-06-10[Ada] Incorrect accessibility checks on functions callsJustin Squirek1-4/+15
2020-06-10 Justin Squirek <squirek@adacore.com> gcc/ada/ * exp_ch3.adb (Expand_N_Object_Declaration): Add condition to handle processing of objects initialized by a call to a function return an anonymous access type. * exp_ch6.adb, exp_ch6.ads (Has_Unconstrained_Access_Discriminants): Moved to sem_util.adb (Needs_Result_Accessibility_Level): Moved to sem_util.adb * sem_util.adb, sem_util.ads (Has_Unconstrained_Access_Discriminants): Moved from exp_ch6.adb (Needs_Result_Accessibility_Level): Moved from exp_ch6.adb * sem_res.adb (Valid_Conversion): Add condition for the special case where the operand of a conversion is the result of an anonymous access type
2020-06-09[Ada] Code refactoring on calls to Set_Debug_Info_NeededArnaud Charlet1-0/+4
2020-06-09 Arnaud Charlet <charlet@adacore.com> gcc/ada/ * sem_util.ads, sem_util.adb (Set_Debug_Info_Defining_Id): New. * exp_ch3.adb, exp_ch8.adb: Call Set_Debug_Info_Defining_Id when relevant.
2020-06-09[Ada] Propagate DIC, Invariant and Predicate attributes to viewsEric Botcazou1-5/+11
2020-06-09 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * checks.adb (Apply_Predicate_Check): Extend trick used for aggregates to qualified aggregates and object declarations * einfo.ads (Has_Own_DIC): Mention the underlying full view. (Has_Own_Invariants): Likewise. (Has_Predicates): Likewise. * exp_util.adb (Build_DIC_Procedure_Declaration): Do not deal with base types explicitly but with underlying full views. (Build_Invariant_Procedure_Declaration): Likewise. * sem_ch13.adb (Build_Predicate_Functions): Do not deal with the full view manually but call Propagate_Predicate_Attributes to propagate attributes to views. (Build_Predicate_Function_Declaration): Likewise. * sem_ch3.adb (Build_Assertion_Bodies_For_Type): Build bodies for private full views with an underlying full view. (Build_Derived_Private_Type): Small comment tweak. (Complete_Private_Subtype): Call Propagate_Predicate_Attributes. (Process_Full_View): Do not deal with base types explicitly for DIC and Invariant attributes. Deal with underlying full views for them. Call Propagate_Predicate_Attributes and deal with underlying full views for them. * sem_ch7.adb (Preserve_Full_Attributes): Do not cross propagate DIC and Invariant attributes between full type and its base type. Propagate Predicate attributes from the full to the private view. * sem_ch9.adb (Analyze_Protected_Type_Declaration): Likewise. (Analyze_Task_Type_Declaration): Likewise. * sem_util.ads (Get_Views): Remove Full_Base parameter and add UFull_Typ parameter. (Propagate_Predicate_Attributes): New procedure. * sem_util.adb (Get_Views): Remove Full_Base parameter and add UFull_Typ parameter. Retrieve the Corresponding_Record_Type from the underlying full view, if any. (Propagate_DIC_Attributes): Remove useless tests. (Propagate_Invariant_Attributes): Likewise. (Propagate_Predicate_Attributes): New procedure.
2020-06-09[Ada] Ada2020: AI12-0301 Predicates and Default_ValueArnaud Charlet1-1/+2
2020-06-09 Arnaud Charlet <charlet@adacore.com> gcc/ada/ * sem_util.ads, sem_util.adb (Is_Partially_Initialized_Type): Take Default_Value and Default_Component_Value into account. * sem_ch3.adb (Analyze_Object_Declaration): Update comment.