aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/decl.c
AgeCommit message (Collapse)AuthorFilesLines
2020-12-07Housekeeping work in gigiEric Botcazou1-1/+1
gcc/ada/ChangeLog: * gcc-interface/Make-lang.in: Remove ^L characters. * gcc-interface/decl.c (create_concat_name): Add cast.
2020-12-07Fix oversight in earlier changeEric Botcazou1-0/+1
gcc/ada/ChangeLog: * gcc-interface/decl.c (gnat_to_gnu_entity) <Fixed_Point_Type>: Put back the "else" unduly removed.
2020-11-19Enhance debug info for fixed-point typesEric Botcazou1-33/+10
The Ada language supports fixed-point types as first-class citizens so they need to be described as-is in the debug info. We devised the langhook get_fixed_point_type_info for this purpose a few years ago, but it comes with a limitation for the representation of the scale factor that we would need to lift in order to be able to represent more fixed-point types. gcc/ChangeLog: * dwarf2out.h (struct fixed_point_type_info) <scale_factor>: Turn numerator and denominator into a tree. * dwarf2out.c (base_type_die): In the case of a fixed-point type with arbitrary scale factor, call add_scalar_info on numerator and denominator to emit the appropriate attributes. gcc/ada/ChangeLog: * exp_dbug.adb (Is_Handled_Scale_Factor): Delete. (Get_Encoded_Name): Do not call it. * gcc-interface/decl.c (gnat_to_gnu_entity) <Fixed_Point_Type>: Tidy up and always use a meaningful description for arbitrary scale factors. * gcc-interface/misc.c (gnat_get_fixed_point_type_info): Remove obsolete block and adjust the description of the scale factor.
2020-11-11Remove superfluous call to Base_TypeEric Botcazou1-19/+19
gcc/ada/ChangeLog: * gcc-interface/gigi.h: Remove ^L characters throughout. * gcc-interface/decl.c: Likewise. * gcc-interface/utils.c: Likewise. * gcc-interface/utils2.c: Likewise. * gcc-interface/trans.c (gnat_to_gnu) <N_Allocator>: Do not explicitly go to the base type for the Has_Constrained_Partial_View flag.
2020-11-11Fix internal error on chain of constants with -gnatcEric Botcazou1-4/+7
gcc/ada/ChangeLog: * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Constant>: In case the constant is not being defined, get the expression in type annotation mode only if its type is elementary.
2020-10-23[Ada] Implement new legality rules introduced in C.6(12) by AI12-0363Eric Botcazou1-20/+26
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-09-28Fix bogus alignment warning on address clauseEric Botcazou1-8/+20
The compiler gives a bogus alignment warning on an address clause and a discriminated record type with variable size. gcc/ada/ChangeLog: * gcc-interface/decl.c (maybe_saturate_size): Add ALIGN parameter and round down the result to ALIGN. (gnat_to_gnu_entity): Adjust calls to maybe_saturate_size. gcc/testsuite/ChangeLog: * gnat.dg/addr16.adb: New test. * gnat.dg/addr16_pkg.ads: New helper.
2020-09-12Add preliminary support for 128-bit integer typesEric Botcazou1-1/+1
This is only the gigi part, in preparation for the bulk of the implementation. gcc/ada/ChangeLog: * fe.h: Fix pilot error in previous change. * gcc-interface/gigi.h (enum standard_datatypes): Add ADT_mulv128_decl. (mulv128_decl): New macro. (get_target_long_long_long_size): Declare. * gcc-interface/decl.c (gnat_to_gnu_entity): Use a maximum size of 128 bits for discrete types if Enable_128bit_Types is true. * gcc-interface/targtyps.c: Include target.h. (get_target_long_long_long_size): New function. * gcc-interface/trans.c (gigi): Initialize mulv128_decl if need be. (build_binary_op_trapv): Call it for 128-bit multiplication. * gcc-interface/utils.c (make_type_from_size): Enforce a maximum size of 128 bits if Enable_128bit_Types is true.
2020-09-12Accept absolute address clause for array of UNC nominal subtypeEric Botcazou1-0/+13
This changes the compiler to accept again absolute address clause for aliased array of unconstrained nominal subtype, instead of erroring out in this case. gcc/ada/ChangeLog: * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Only give a warning for the overlay of an aliased array with an unconstrained nominal subtype if the address is absolute.
2020-09-11Fix crash on array component with nonstandard index typeEric Botcazou1-6/+6
This is a regression present on mainline, 10 and 9 branches: the compiler goes into an infinite recursion eventually exhausting the stack for the declaration of a discriminated record type with an array component having a discriminant as bound and an index type that is an enumeration type with a non-standard representation clause. gcc/ada/ChangeLog: * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Subtype>: Only create extra subtypes for discriminants if the RM size of the base type of the index type is lower than that of the index type. gcc/testsuite/ChangeLog: * gnat.dg/specs/discr7.ads: New test.
2020-09-10Fix bogus error on Value_Size clause for variant record typeEric Botcazou1-2/+4
This is a regression present on the mainline and 10 branch: the compiler rejects a Value_Size clause on a discriminated record type with variant. gcc/ada/ChangeLog: * gcc-interface/decl.c (set_rm_size): Do not take into account the Value_Size clause if it is not for the entity itself. gcc/testsuite/ChangeLog: * gnat.dg/specs/size_clause5.ads: New test.
2020-09-10Fix uninitialized variable with nested variant record typesEric Botcazou1-5/+9
This fixes a wrong code issue with nested variant record types: the compiler generates move instructions that depend on an uninitialized variable, which was initially a SAVE_EXPR not instantiated early enough. gcc/ada/ChangeLog: * gcc-interface/decl.c (build_subst_list): For a definition, make sure to instantiate the SAVE_EXPRs generated by the elaboration of the constraints in front of the elaboration of the type itself. gcc/testsuite/ChangeLog: * gnat.dg/discr59.adb: New test. * gnat.dg/discr59_pkg1.ads: New helper. * gnat.dg/discr59_pkg2.ads: Likewise.
2020-07-02Reject components in extensions overlapping with the parentEric Botcazou1-6/+6
Such problematic components can be specified by means of a component clause but they cannot be fully supported by the type system. They had initially been forbidden, then we decided to accept them by working around the type system, but this is very fragile and, for example, any static aggregate is guaranteed to trigger an ICE with the current implementation. We now reject them again, except if the -gnatd.K switch is passed. gcc/ada/ChangeLog: * debug.adb (d.K): Document new usage. * fe.h (Debug_Flag_Dot_KK): Declare. * gcc-interface/decl.c (gnat_to_gnu_field): Give an error when the component overlaps with the parent subtype, except with -gnatd.K.
2020-06-23Minor tweak to elaborate_expression_1Eric Botcazou1-4/+13
gcc/ada/ChangeLog: * gcc-interface/decl.c (elaborate_expression_1): When GNAT encodings are not used, do not create a variable for debug info purposes if the expression is itself a user-declared variable.
2020-06-23Streamline implementation of renaming in gigiEric Botcazou1-74/+52
The main changes are 1) the bulk of the implementation is put back entirely in gnat_to_gnu_entity and 2) the handling of lvalues is unified, i.e. it no longer depends on the Materialize_Entity flag being present on the entity. gcc/ada/ChangeLog: * gcc-interface/ada-tree.h (DECL_RENAMED_OBJECT): Delete. * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Always use the stabilized reference directly for renaming and create a variable pointing to it separately if requested. * gcc-interface/misc.c (gnat_print_decl): Adjust for deletion. * gcc-interface/trans.c (Identifier_to_gnu): Likewise. (gnat_to_gnu) <N_Object_Renaming_Declaration>: Do not deal with side-effects here. <N_Exception_Renaming_Declaration>: Likewise.
2020-06-23Minor cleanup in elaborate_expressionEric Botcazou1-2/+2
gcc/ada/ChangeLog: * gcc-interface/decl.c (elaborate_expression): Replace calls to Is_OK_Static_Expression with Compile_Time_Known_Value.
2020-06-23Emit user subtypes with -fgnat-encodings=minimalEric Botcazou1-12/+7
This changes the compiler to emit debug info for user-defined subtypes with -fgnat-encodings=minimal, as they might be needed by the debugger. gcc/ada/ChangeLog: * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Record_Subtype>: Set debug type to the base type and only if the subtype is artificial.
2020-06-19[Ada] AI12-0028-1 Import of variadic C functionsEric Botcazou1-9/+11
2020-06-19 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * gcc-interface/decl.c (gnat_to_gnu_param): Tidy up. (gnat_to_gnu_subprog_type): For a variadic C function, do not build unnamed parameters and do not add final void node. * gcc-interface/misc.c: Include snames.h. * gcc-interface/trans.c (Attribute_to_gnu): Tidy up. (Call_to_gnu): Implement support for unnamed parameters in a variadic C function. * gcc-interface/utils.c: Include snames.h. (copy_type): Tidy up.
2020-05-26Fix issue with LTO bootstrapEric Botcazou1-9/+0
gcc/ada/ChangeLog PR ada/95333 * gcc-interface/decl.c (gnat_to_gnu_param): Never make a variant of the type.
2020-05-25Fix internal error on problematic renamingEric Botcazou1-46/+55
This is an internal renaming generated for a generalized loop iteration made on a tagged record type with predicate, and gigi cannot use the most efficient way of implementing renamings because the renamed object is an expression with a non-empty Actions list. gcc/ada/ChangeLog * gcc-interface/decl.c (gnat_to_gnu_entity): Add new local variable and use it throughout the function. <E_Variable>: Rename local variable and adjust accordingly. In the case of a renaming, materialize the entity if the renamed object is an N_Expression_With_Actions node. <E_Procedure>: Use Alias accessor function consistently. gcc/testsuite/ChangeLog * gnat.dg/renaming16.adb: New test. * gnat.dg/renaming16_pkg.ads: New helper.
2020-05-25Fix missing back-annotation for derived typesEric Botcazou1-27/+43
Gigi fails to back-annotate the Present_Expr field of variants present in a type derived from a discriminated untagged record type, which is for example visible in the output -gnatRj. gcc/ada/ChangeLog * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Record_Type>: Tidy up. (build_variant_list): Add GNAT_VARIANT_PART parameter and annotate its variants if it is present. Adjust the recursive call by passing the variant subpart of variants, if any. (copy_and_substitute_in_layout): Rename GNU_SUBST_LIST to SUBST_LIST and adjust throughout. For a type, pass the variant part in the call to build_variant_list.
2020-05-25Fix incorrect handling of Component_SizeEric Botcazou1-3/+18
The compiler can mishandle a Component_Size clause on an array type specifying a size multiple of the storage unit, when this size is not a multiple of the alignment of the component type. gcc/ada/ChangeLog * gcc-interface/decl.c (gnat_to_gnu_component_type): Cap alignment of the component type according to the component size. gcc/testsuite/ChangeLog * gnat.dg/array40.adb: New test. * gnat.dg/array40_pkg.ads: New helper.
2020-05-25Change description of fat pointertype with -fgnat-encodings=minimalEric Botcazou1-40/+56
This makes a step back in the representation of fat pointer types in the debug info with -fgnat-encodings=minimal so as to avoid hiding the data indirection and making it easiser to synthetize the construct. gcc/ada/ChangeLog * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Type>: Add a description of the various types associated with the unconstrained type. Declare the fat pointer earlier. Set the current function as context on the template type, and the fat pointer type on the array type. Always mark the fat pointer type as artificial and set it as the context for the pointer type to the array. Also reuse GNU_ENTITY_NAME. Finish up the unconstrained type at the very end. * gcc-interface/misc.c (gnat_get_array_descr_info): Do not handle fat pointer types and tidy up accordingly. * gcc-interface/utils.c (build_unc_object_type): Do not set the context on the template type.
2020-05-09Update copyright yearEric Botcazou1-1/+1
2020-05-09Fix small issues with -fgnat-encodings=minimalEric Botcazou1-103/+130
This is the mode where the GNAT compiler does not use special encodings in the debug info to describe some Ada constructs, for example packed array types. * gcc-interface/ada-tree.h (TYPE_PACKED_ARRAY_TYPE_P): Rename into... (TYPE_BIT_PACKED_ARRAY_TYPE_P): ...this. (TYPE_IS_PACKED_ARRAY_TYPE_P): Rename into... (BIT_PACKED_ARRAY_TYPE_P): ...this. (TYPE_IMPL_PACKED_ARRAY_P): Adjust to above renaming. * gcc-interface/gigi.h (maybe_pad_type): Remove IS_USER_TYPE.. * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Adjust call to maybe_pad_type. <E_Ordinary_Fixed_Point_Type>: Remove const qualifiers for tree. <E_Signed_Integer_Subtype>: Remove redundant test and redundant call to associate_original_type_to_packed_array. Turn into assertion. Call associate_original_type_to_packed_array and modify gnu_entity_name accordingly. Explicitly set the parallel type for GNAT encodings. Call create_type_decl in the misaligned case before maybe_pad_type. <E_Array_Type>: Do not use the name of the implementation type for a packed array when not using GNAT encodings. <E_Array_Subtype>: Move around setting flags. Use the result of the call to associate_original_type_to_packed_array for gnu_entity_name. <E_Record_Subtype>: Create XVS type and XVZ variable only if debug info is requested for the type. Call create_type_decl if a padded type was created for a type entity (gnat_to_gnu_component_type): Use local variable and adjust calls to maybe_pad_type. (gnat_to_gnu_subprog_type): Adjust call to maybe_pad_type. (gnat_to_gnu_field): Likewise. (validate_size): Adjust to renaming of macro. (set_rm_size): Likewise. (associate_original_type_to_packed_array): Adjust return type and return the name of the original type if GNAT encodings are not used * gcc-interface/misc.c (gnat_get_debug_typ): Remove obsolete stuff. (gnat_get_fixed_point_type_info): Remove const qualifiers for tree. (gnat_get_array_descr_info): Likewise and set variables lazily. Remove call to maybe_debug_type. Simplify a few computations. (enumerate_modes): Remove const qualifier for tree. * gcc-interface/utils.c (make_type_from_size): Adjust to renaming. (maybe_pad_type): Remove IS_USER_TYPE parameter and adjust. Remove specific code for implementation types for packed arrays. (compute_deferred_decl_context): Remove const qualifier for tree. (convert): Adjust call to maybe_pad_type. (unchecked_convert): Likewise. * gcc-interface/utils2.c (is_simple_additive_expressio): Likewise.
2020-05-09Fix missing back-annotation for Out parameterEric Botcazou1-1/+4
This happens when it is passed by copy and not passed in. * gcc-interface/decl.c (gnat_to_gnu_param): Also back-annotate the mechanism in the case of an Out parameter only passed by copy-out.
2020-05-08Fix uniqueness of address for aliased objectsEric Botcazou1-3/+12
Two aliased objects must have distinct addresses, even if they have size zero, so we make sure to allocate at least one byte for them. * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Force at least the unit size for an aliased object of a constrained nominal subtype whose size is variable.
2020-05-08Couple of tweaks to help in LTO modeEric Botcazou1-0/+16
The first tweak is to remove the TREE_OVERFLOW flag on INTEGER_CSTs because it prevents them from being uniquized in LTO mode. The second, unrelated tweak is to canonicalize the packable types made by gigi so that at most one per type is present in the GENERIC IL. * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Subtype>: Deal with artificial maximally-sized types designed by access types. * gcc-interface/utils.c (packable_type_hash): New structure. (packable_type_hasher): Likewise. (packable_type_hash_table): New hash table. (init_gnat_utils): Initialize it. (destroy_gnat_utils): Destroy it. (packable_type_hasher::equal): New method. (hash_packable_type): New static function. (canonicalize_packable_type): Likewise. (make_packable_type): Make sure not to use too small a type for the size of the new fields. Canonicalize the type if it is named.
2020-05-08Small tweak to gnat_to_gnu_paramEric Botcazou1-2/+5
We mark the type of In parameters in Ada with the const qualifier, but it is stripped by free_lang_data_in_type so do not do it in LTO mode. * gcc-interface/decl.c (gnat_to_gnu_param): Do not make a variant of the type in LTO mode.
2020-03-11Fix internal error on locally-defined subpoolsEric Botcazou1-1/+8
If the type is derived in the current compilation unit, and Allocate is not overridden on derivation (as is typically the case with Root_Storage_Pool_With_Subpools), the entity for Allocate of the derived type is an alias for System.Storage_Pools.Subpools.Allocate. The main assertion in gnat_to_gnu_entity fails in this case, since this is not a definition and Is_Public is false (since the entity is nested in the same compilation unit). 2020-03-11 Richard Wai <richard@annexi-strayline.com> * gcc-interface/decl.c (gnat_to_gnu_entity): Also test Is_Public on the Alias of the entitiy, if is present, in the main assertion.
2019-12-18[Ada] Do not propagate Object_Size onto Size for composite typesEric Botcazou1-5/+20
2019-12-18 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * layout.adb (Layout_Type): In the case of composite types, do not copy the Esize onto the RM_Size if the latter is not set. * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Record_Type>: Also cap the alignment if an Object_Size clause has been specified. Pass VAR_DECL in the call to validate_size for the Esize of a type. (validate_size): Be prepared to give an error on an Object_Size clause. From-SVN: r279507
2019-12-16[Ada] AI12-0001: Independence and Representation clauses for atomic objectsEric Botcazou1-43/+59
2019-12-16 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * gcc-interface/decl.c (gnat_to_gnu_entity): Adjust calls to validate_size. (gnat_to_gnu_component_type): Likewise. (gnat_to_gnu_field): Likewise and pass string for error messages. (components_need_strict_alignment): Remove test on Is_Aliased and add test for the independence of the component. (validate_size): Add S1 and S2 string parameters and use them to give better error messages for fields. Tweak a couple of messages. * einfo.ads (Has_Independent_Components): Document more cases. (Is_Independent): Likewise. (Strict_Alignment): Document new semantics. * exp_ch9.adb (Install_Private_Data_Declarations): Also set the Is_Independent flag along with Is_Aliased on the renaming entity. * freeze.adb (Size_Known): Remove always-false test and add test for the strict-alignment on the record type. Remove redundant tests and add test for the strict-alignment on the component type. (Check_Strict_Alignment): Set the flag if the type is by-ref and remove now redundant conditions. Set the flag on an array type if it has aliased components. In the record type case, do not set type for C_Pass_By_Copy convention. (Freeze_Array_Type): Move code checking for conflicts between representation aspects and clauses to before specific handling of packed array types. Give a warnind instead of an error for a conflict with pragma Pack. Do not test Has_Pragma_Pack for the specific handling of packed array types. (Freeze_Record_Type): Move error checking of representation clause to... (Freeze_Entity): ...here after Check_Strict_Alignment is called. * sem_aggr.adb (Array_Aggr_Subtype): Also set the Is_Independent flag along with Is_Aliased on the Itype. * sem_ch13.adb (Check_Record_Representation_Clause): Do not set the RM size for a strict-alignment type. * sem_ch3.adb (Add_Interface_Tag_Components): Also set the Is_Independent flag along with Is_Aliased on the tag. (Add_Interface_Tag_Components): Likewise on the offset. (Analyze_Component_Declaration): Likewise on the component. (Analyze_Object_Declaration): Likewise on the object. (Constrain_Array): Likewise on the array. (Record_Type_Declaration: Likewise on the tag. (Array_Type_Declaration): Also set the Has_Independent_Components flag along with Has_Aliased_Components on the array. (Copy_Array_Base_Type_Attributes): Copy Has_Independent_Components. (Copy_Array_Subtype_Attributes): Copy Is_Atomic, Is_Independent and Is_Volatile_Full_Access. (Analyze_Iterator_Specification): Set Is_Independent on the loop variable according to Independent_Components on the array. * sem_ch5.adb: Likewise. * sem_ch6.adb (Process_Formals): Also set the Is_Independent flag along with Is_Aliased on the formal. gcc/testsuite/ * gnat.dg/specs/clause_on_volatile.ads, gnat.dg/specs/size_clause3.ads: Update expected diagnostics. From-SVN: r279430
2019-12-03decl.c (gnat_to_gnu_subprog_type): With the Copy-In/ Copy-Out mechanism...Eric Botcazou1-8/+51
* gcc-interface/decl.c (gnat_to_gnu_subprog_type): With the Copy-In/ Copy-Out mechanism, do not promote the mode of the return type to an integral mode if it contains a field on a non-integral type and even demote it for 64-bit targets. From-SVN: r278927
2019-10-11decl.c (elaborate_reference_1): Specifically deal with pointer displacement.Eric Botcazou1-1/+10
* gcc-interface/decl.c (elaborate_reference_1): Specifically deal with pointer displacement. * gcc-interface/decl.c (components_to_record): Use proper name. * gcc-interface/trans.c (Sloc_to_locus): Use standard types. From-SVN: r276874
2019-10-11decl.c (gnat_to_gnu_field): Adjust again the packing for a field without ↵Eric Botcazou1-0/+7
strict alignment and with an... * gcc-interface/decl.c (gnat_to_gnu_field): Adjust again the packing for a field without strict alignment and with an oversized clause. From-SVN: r276873
2019-10-11decl.c (annotate_value): Really test the sign of the value when deciding to ↵Eric Botcazou1-9/+7
build a NEGATE_EXPR. * gcc-interface/decl.c (annotate_value) <INTEGER_CST>: Really test the sign of the value when deciding to build a NEGATE_EXPR. <PLUS_EXPR>: Remove redundant line. <BIT_AND_EXPR>: Do the negation here. From-SVN: r276866
2019-10-11decl.c (Gigi_Equivalent_Type): New case.Eric Botcazou1-0/+5
* gcc-interface/decl.c (Gigi_Equivalent_Type) <E_Array_Subtype>: New case. Return the base type if the subtype is not constrained. From-SVN: r276865
2019-10-11decl.c (gnat_to_gnu_entity): New case to deal with the definition of named ↵Eric Botcazou1-6/+28
numbers. * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Named_{Integer|Real}>: New case to deal with the definition of named numbers. <E_Variable>: Minor tweaks. Set DECL_IGNORED_P on the CONST_DECL if a corresponding variable is built. * gcc-interface/trans.c (gnat_to_gnu) <N_Integer_Literal>: Return error_mark_node instead of aborting on overflow for named numbers. <N_Number_Declaration>: Reuse the <N_Object_Declaration> case and deal with error_mark_node specifically. * gcc-interface/utils.c (create_var_decl): Do not set DECL_IGNORED_P on CONST_DECLs. (gnat_write_global_declarations): Output global constants. From-SVN: r276864
2019-09-27set DECL_SIZE_UNIT for zero-sized fieldsAlexandre Oliva1-0/+1
Zero-sized fields do not get processed by finish_record_type: they're removed from the field list before and reinserted after, so their DECL_SIZE_UNIT remains unset, causing the translation of assignment statements with use_memset_p, in quite unusual circumstances, to use a NULL_TREE as the memset length. This patch sets DECL_SIZE_UNIT for the zero-sized fields, that don't go through language-independent layout, in language-specific layout. for gcc/ada/ChangeLog * gcc-interface/decl.c (components_to_record): Set DECL_SIZE_UNIT for zero-sized fields. From-SVN: r276173
2019-09-23decl.c (components_to_record): Do not reorder fields in packed record types ↵Eric Botcazou1-4/+11
if... * gcc-interface/decl.c (components_to_record): Do not reorder fields in packed record types if they contain fixed-size fields that cannot be laid out in a packed manner. From-SVN: r276036
2019-08-30decl.c (maybe_saturate_size): New function.Eric Botcazou1-5/+20
* gcc-interface/decl.c (maybe_saturate_size): New function. (gnat_to_gnu_entity): Invoke it on the Esize of types before sending it for back-annotations. * gcc-interface/trans.c: Fix typo. From-SVN: r275200
2019-08-30ada-tree.h (DECL_FORCED_BY_REF_P): New macro.Eric Botcazou1-1/+7
* gcc-interface/ada-tree.h (DECL_FORCED_BY_REF_P): New macro. * gcc-interface/decl.c (gnat_to_gnu_param): Set it on parameters whose mechanism was forced to by-reference. * gcc-interface/trans.c (Call_to_gnu): Do not issue a warning about a misaligned actual parameter if it is based on a CONSTRUCTOR. Remove obsolete warning for users of Starlet. Issue a warning if a temporary is make around the call for a parameter with DECL_FORCED_BY_REF_P set. (addressable_p): Return true for REAL_CST and ADDR_EXPR. From-SVN: r275198
2019-08-30gigi.h (aggregate_type_contains_array_p): Declare.Eric Botcazou1-32/+11
* gcc-interface/gigi.h (aggregate_type_contains_array_p): Declare. * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Record_Type>: For an extension, test Has_Record_Rep_Clause instead of Has_Specified_Layout. (adjust_packed): Return 0 if the type of the field is an aggregate type that contains (or is) a self-referential array. (type_has_variable_size): Delete. * gcc-interface/utils.c (inish_record_type): Constify a variable. (aggregate_type_contains_array_p): Add parameter SELF_REFERENTIAL. <RECORD_TYPE>: Pass it in the recursive call. <ARRAY_TYPE>: If it is true, return true only if the array type is self-referential. (create_field_decl): Streamline the setting of the alignment on the field. Pass false to aggregate_type_contains_array_p. From-SVN: r275196
2019-08-30decl.c (annotate_value): Inline the call also if List_Representation_Info is ↵Eric Botcazou1-1/+1
greater than 3. * gcc-interface/decl.c (annotate_value) <CALL_EXPR>: Inline the call also if List_Representation_Info is greater than 3. From-SVN: r275188
2019-08-30gigi.h (gigi_checking_assert): New macro.Eric Botcazou1-22/+17
* gcc-interface/gigi.h (gigi_checking_assert): New macro. * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Modular_Integer_Type>: Remove redundant test and adjust comments. Minor tweaks. * gcc-interface/trans.c (Call_to_gnu): Do not generate range checks, instead assert that the Do_Range_Check flag is not set. Adjust call to convert_with_check. (gnat_to_gnu): Likewise. (assoc_to_constructor): Likewise. (pos_to_constructor): Likewise. Remove GNAT_COMPONENT_TYPE parameter. (emit_range_check): Delete. (convert_with_check): Remove RANGE_P parameter and adjust. Do a single overflow check for modular types. From-SVN: r275174
2019-06-29decl.c (gnat_to_gnu_entity): Beep up comment on SAVED...Eric Botcazou1-13/+35
* gcc-interface/decl.c (gnat_to_gnu_entity): Beep up comment on SAVED, and tweak comment on the assertion about the scopes of Itypes. Do not skip the regular processing for Itypes that are E_Record_Subtype with a Cloned_Subtype. Get the Cloned_Subtype for every E_Record_Subtype if the type is dummy and hasn't got its own freeze node. <E_Record_Subtype>: Save again the DECL of the Cloned_Subtype, if any. <E_Access_Subtype>: Save again the DECL of the equivalent type. (Gigi_Equivalent_Type) <E_Access_Subtype>: New case. From-SVN: r272822
2019-06-29decl.c (gnat_to_gnu_entity): If the type requires strict alignment, then set ↵Eric Botcazou1-59/+57
the RM size to the type size. * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Record_Type>: If the type requires strict alignment, then set the RM size to the type size. Rework handling of alignment and sizes of tagged types in ASIS mode. (validate_size): Rename local variable and remove special handling for strict-alignment types. * gcc-interface/utils.c (finish_record_type): Constify local variables and use properly typed constants. From-SVN: r272820
2019-06-29decl.c (gnat_to_gnu_field): Rework error messages for fields requiring ↵Eric Botcazou1-53/+56
strict alignment... * gcc-interface/decl.c (gnat_to_gnu_field): Rework error messages for fields requiring strict alignment, add explicit test on Storage_Unit for position and size, and mention type alignment for position. From-SVN: r272819
2019-06-29decl.c (set_nonaliased_component_on_array_type): Add missing guard for the ↵Eric Botcazou1-2/+4
presence of TYPE_CANONICAL. * gcc-interface/decl.c (set_nonaliased_component_on_array_type): Add missing guard for the presence of TYPE_CANONICAL. (set_reverse_storage_order_on_array_type): Likewise. From-SVN: r272811
2019-06-29expr.c (expand_expr_real_1): Apply the big-endian adjustment for bit-fields ↵Eric Botcazou1-28/+42
to all aggregate types. * expr.c (expand_expr_real_1) <BIT_FIELD_REF>: Apply the big-endian adjustment for bit-fields to all aggregate types. ada/ * gcc-interface/gigi.h (make_packable_type): Remove default value. (value_factor_p): Tweak prototype. * gcc-interface/decl.c (gnat_to_gnu_entity): Add comment. (gnat_to_gnu_component_type): Likewise. (gnat_to_gnu_field): Likewise. Fetch the position of the field earlier and simplify the condition under which the type is packed. Declare local variable is_bitfield. Pass 1 as max_align to make_packable_type if it is set to true. (copy_and_substitute_in_layout): Pass 0 to make_packable_type. * gcc-interface/utils.c (make_packable_array_type): New function. (make_packable_type): Use it to rewrite the type of array field. (maybe_pad_type): Pass align parameter to make_packable_type. (create_field_decl): Minor tweaks. (value_factor_p): Assert that FACTOR is a power of 2 and replace the modulo computation by a masking operation. From-SVN: r272810