aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/decl.c
AgeCommit message (Collapse)AuthorFilesLines
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
2019-06-25decl.c (gnat_to_gnu_entity): Remove superfluous test in previous change.Eric Botcazou1-2/+1
* gcc-interface/decl.c (gnat_to_gnu_entity): Remove superfluous test in previous change. * gcc-interface/gigi.h (maybe_character_type): Fix formatting. (maybe_character_value): Likewise. From-SVN: r272637
2019-06-24ipa-utils.h (type_with_linkage_p): Verify that type is CXX_ODR_P.Jan Hubicka1-1/+3
* ipa-utils.h (type_with_linkage_p): Verify that type is CXX_ODR_P. (odr_type_p): Remove extra return. * lto-streamer-out.c (hash_tree): Hash TYPE_CXX_ODR_P; hash STRING_FLAG only for arrays and integers. * tree-stremaer-in.c (unpack_ts_type_common_value_fields): Update analogously. * tree-streamer-out.c (pack_ts_type_common_value_fields): Likewise. * print-tree.c (print_node): Print cxx-odr-p and string-flag. * tree.c (need_assembler_name_p): Also check that type is CXX_ODR_TYPE_P (verify_type_variant): Update verification of SRING_FLAG; also check CXX_ODR_P. * tree.h (ARRAY_OR_INTEGER_TYPE_CHECK): New macro. (TYPE_STRING_FLAG): Use it. (TYPE_CXX_ODR_P): New macro. * lto-common.c (compare_tree_sccs_1): Compare CXX_ODR_P; compare STRING_FLAG only for arrays and integers. * gcc-interface/decl.c (gnat_to_gnu_entity): Check that type is array or integer prior checking string flag. * gcc-interface/gigi.h (gnat_signed_type_for, maybe_character_value): Likewise. * c-common.c (braced_lists_to_strings): Check that type is array or integer prior checking string flag. * lex.c (cxx_make_type): Set TYPE_CXX_ODR_P. * dwarf2out.c (gen_array_type_die): First check that type is an array and then test string flag. * trans-expr.c (gfc_conv_substring): Check that type is array or integer prior checking string flag. (gfc_conv_string_parameter): Likewise. * trans-openmp.c (gfc_omp_scalar_p): Likewise. * trans.c (gfc_build_array_ref): Likewise. From-SVN: r272628
2019-05-28implementation_defined_pragmas.rst (Machine_Attribute): Document additional ↵Eric Botcazou1-46/+39
optional parameters. * doc/gnat_rm/implementation_defined_pragmas.rst (Machine_Attribute): Document additional optional parameters. * sem_prag.adb (Analyze_Pragma) <Pragma_Machine_Attribute>: Accept more than one optional parameter. * gcc-interface/decl.c (prepend_one_attribute_pragma): Alphabetize the list of supported pragmas. Simplify the handling of parameters and add support for more than one optional parameter. * gcc-interface/utils.c (attr_cold_hot_exclusions): New constant. (gnat_internal_attribute_table): Add entry for no_icf, noipa, flatten, used, cold, hot, target and target_clones. (begin_subprog_body): Do not create the RTL for the subprogram here. (handle_noicf_attribute): New static function. (handle_noipa_attribute): Likewise. (handle_flatten_attribute): Likewise. (handle_used_attribute): Likewise. (handle_cold_attribute): Likewise. (handle_hot_attribute): Likewise. (handle_target_attribute): Likewise. (handle_target_clones_attribute): Likewise. From-SVN: r271693
2019-05-28decl.c (gnat_to_gnu_entity): Remove obsolete test on Is_For_Access_Subtype.Eric Botcazou1-1/+0
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Record_Subtype>: Remove obsolete test on Is_For_Access_Subtype. From-SVN: r271683
2019-05-28decl.c (components_to_record): Set a name on the type created for the REP ↵Eric Botcazou1-0/+2
part, if any. * gcc-interface/decl.c (components_to_record): Set a name on the type created for the REP part, if any. * gcc-interface/utils.c (finish_record_type): Only take the maximum when merging sizes for a variant part at offset 0. (merge_sizes): Rename has_rep parameter into max. From-SVN: r271681
2019-05-28decl.c (intrin_arglists_compatible_p): Do not return false if the internal ↵Eric Botcazou1-3/+3
builtin uses a variable list. * gcc-interface/decl.c (intrin_arglists_compatible_p): Do not return false if the internal builtin uses a variable list. From-SVN: r271679
2019-01-27repinfo.adb (List_Component_Layout): Remove superfluous space for zero-sized ↵Eric Botcazou1-189/+173
field. * repinfo.adb (List_Component_Layout): Remove superfluous space for zero-sized field. * gcc-interface/ada-tree.h (TYPE_IS_EXTRA_SUBTYPE_P): New macro. * gcc-interface/gigi.h (create_extra_subtype): Declare. * gcc-interface/decl.c (TYPE_ARRAY_SIZE_LIMIT): Likewise. (update_n_elem): New function. (gnat_to_gnu_entity): Use create_extra_subtype to create extra subtypes instead of doing it manually. <E_Array_Type>: Use update_n_elem to compute the maximum size. Use the index type instead of base type for the bounds. Set TYPE_ARRAY_MAX_SIZE of the array to the maximum size. <E_Array_Subtype>: Create an extra subtype using the index type of the base array type for self-referential bounds. Use update_n_elem to compute the maximum size. Set TYPE_ARRAY_MAX_SIZE of the array to the maximum size. (gnat_to_gnu_field): Clear DECL_NONADDRESSABLE_P on discriminants. * gcc-interface/misc.c (gnat_get_alias_set): Return the alias set of the base type for an extra subtype. (gnat_type_max_size): Remove obsolete code. * gcc-interface/trans.c (Attribute_to_gnu): Minor tweak. (can_be_lower_p): Deal with pathological types. * gcc-interface/utils.c (create_extra_subtype): New function. (create_field_decl): Minor tweak. (max_size) <tcc_reference>: Compute a better value by using the extra subtypes on the self-referential bounds. <tcc_binary>: Rewrite. Deal with "negative value" in unsigned types. <tcc_expression>: Likewise. * gcc-interface/utils2.c (compare_arrays): Retrieve the original bounds of the arrays upfront. Swap only if the second length is not constant. Use comparisons on the original bounds consistently for the null tests. (build_binary_op): Use TYPE_IS_EXTRA_SUBTYPE_P macro. (build_allocator): Minor tweak. From-SVN: r268318
2019-01-27decl.c (array_type_has_nonaliased_component): Return the same value for ↵Eric Botcazou1-9/+5
every dimension of a multidimensional array type. * gcc-interface/decl.c (array_type_has_nonaliased_component): Return the same value for every dimension of a multidimensional array type. From-SVN: r268314
2019-01-26decl.c (annotate_value): Use test on the sign bit instead of on the sign of ↵Eric Botcazou1-17/+29
the value. * gcc-interface/decl.c (annotate_value) <INTEGER_CST>: Use test on the sign bit instead of on the sign of the value. <PLUS_EXPR>: Turn addition of negative constant into subtraction. <MULT_EXPR>: Add test for degenerate case. <BIT_AND_EXPR>: Simplify. From-SVN: r268286
2019-01-08[Ada] Bump copyright years to 2019Pierre-Marie de Rodat1-1/+1
From-SVN: r267683
2018-12-14decl.c (rm_size): Take into account the padding in the case of a record type ↵Eric Botcazou1-3/+4
containing a template. * gcc-interface/decl.c (rm_size): Take into account the padding in the case of a record type containing a template. * gcc-interface/trans.c (Attribute_to_gnu) <Attr_Size>: Likewise. Do not subtract the padded size for Max_Size_In_Storage_Elements. <Attr_Descriptor_Size>: Tweak comment. From-SVN: r267131
2018-12-14dwarf2out.c (analyze_discr_in_predicate): Simplify.Eric Botcazou1-0/+3
* dwarf2out.c (analyze_discr_in_predicate): Simplify. (analyze_variants_discr): Deal with naked boolean discriminants. ada/ * gcc-interface/decl.c (choices_to_gnu): Directly use a naked boolean discriminant if the value is the boolean true. From-SVN: r267130
2018-12-11[Ada] Fix -gnatR3 output for dynamically constrained recordEric Botcazou1-110/+118
2018-12-11 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * gcc-interface/decl.c (gnat_to_gnu_entity): Add gnat_annotate_type local variable initialized to Empty. <E_Record_Subtype>: Set it to the Cloned_Subtype, if any. For types, back-annotate alignment and size values earlier and only if the DECL was created here; otherwise, if gnat_annotate_type is present, take the values from it. (gnat_to_gnu_field): Add gnat_clause local variable. If a component clause is present, call validate_size only once on the Esize of the component. Otherwise, in the packed case, do not call validate_size again on the type of the component but retrieve directly its RM size. (components_to_record): Minor tweak. (set_rm_size): Remove useless test. * gcc-interface/trans.c (gnat_to_gnu): Do wrap the instance of a boolean discriminant attached to a variant part. From-SVN: r267008
2018-12-11[Ada] Fix elaboration of record with 1-element dynamic arrayEric Botcazou1-4/+8
2018-12-11 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * einfo.ads (Is_Bit_Packed_Array): Fix values of component size. (Is_Packed): Likewise. * gcc-interface/utils.c (convert): Do not extract the value of a justified modular type if the destination type is a regular array. * gcc-interface/decl.c (gnat_to_gnu_component_type): Pass TYPE_DECL to validate_size wherever the array has packed components. From-SVN: r267005
2018-12-11[Ada] Almost always inline init. procedure of small and simple recordsEric Botcazou1-6/+41
2018-12-11 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * fe.h (Debug_Generated_Code): Declare. * gcc-interface/gigi.h (enum inline_status_t): Rename is_disabled to is_default, is_enabled to is_requested and add is_prescribed. * gcc-interface/decl.c (inline_status_for_subprog): New function. (gnat_to_gnu_entity) <E_Subprogram_Type>: Use it to get the inlining status of the subprogram. * gcc-interface/trans.c (gigi): Adjust to above renaming. (build_raise_check): Likewise. (Compilation_Unit_to_gnu): Likewise. (gnat_to_gnu): Likewise. * gcc-interface/utils.c (create_subprog_decl): Likewise. Deal with is_prescribed status by setting DECL_DISREGARD_INLINE_LIMITS. Do not set the DECL_NO_INLINE_WARNING_P flag if Debug_Generated_Code is true. From-SVN: r266976
2018-11-08decl.c (components_to_record): Remove obsolete kludge.Eric Botcazou1-17/+1
* gcc-interface/decl.c (components_to_record): Remove obsolete kludge. * gcc-interface/utils.c (make_packable_type): Set TYPE_PACKED on the new type but do not take into account the setting on the old type for the new fields. Rename a local variable. (finish_record_type): Clear DECL_BIT_FIELD_TYPE on a variant part at offset 0, if any. (create_field_decl): Tweak comment. From-SVN: r265917
2018-10-09[Ada] Fix spurious -Wuninitialized warnings for small recordsEric Botcazou1-3/+6
This change is aimed at getting rid of spurious -Wuninitialized warnings issued for small records passed by copy and containing default values for some of their components. The source of the problem is that the _Init parameter of the initialization routine is declared as an in/out parameter, so the uninitialized object is passed by copy to it and this can be flagged by -Wuninitialized. That's why the mode of the parameter is changed to out, except for the cases where information really needs to be passed in: unconstrained array types, protected and task types. For the following record type Rec! type Rec is record B : Boolean := True; end record; the initialization routine must now be: procedure r__recIP (_init : out r__rec1) is begin _init.b := true; return; end r__recIP; 2018-10-09 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * exp_ch3.adb (Is_Null_Statement_List): New predicate. (Build_Array_Init_Proc): Use it to find out whether the initialization procedure Is_Null_Init_Proc; if so, set Warnings_Off on the parameter. (Build_Init_Procedure): Likewise. (Init_Formals): Use an in/out first parameter only for unconstrained arrays and for records either containing or built for proteced types or task types; use an out parameter in all the other cases. * fe.h (Is_Init_Proc): Declare. * gcc-interface/decl.c (type_requires_init_of_formal): Do not return true for a discriminant in an unchecked union. (gnat_to_gnu_param): Do not create a PARM_DECL for the Out parameter of an initialization procedure. From-SVN: r264984
2018-10-09[Ada] Fix incorrect computation of Component_Size in ASIS modeEric Botcazou1-2/+1
2018-10-09 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Constant>: If this is not a definition, retrieve the expression in all cases even if we are just annotating types. * gcc-interface/trans.c (gnat_to_gnu): Also translate Size attribute for constrained types in this mode. From-SVN: r264983
2018-10-09[Ada] Remove spurious -Wuninitialized warning for small array at -O2Eric Botcazou1-27/+44
2018-10-09 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * gcc-interface/decl.c (type_requires_init_of_formal): New predicate. (gnat_to_gnu_param): Use it to determine whether a PARM_DECL must be created for an Out parameter passed by copy. From-SVN: r264971
2018-09-28calls.c (expand_call): Try to do a tail call for thunks at -O0 too.Eric Botcazou1-3/+3
* calls.c (expand_call): Try to do a tail call for thunks at -O0 too. * cgraph.h (struct cgraph_thunk_info): Add indirect_offset. (cgraph_node::create_thunk): Add indirect_offset parameter. (thunk_adjust): Likewise. * cgraph.c (cgraph_node::create_thunk): Add indirect_offset parameter and initialize the corresponding field with it. (cgraph_node::dump): Dump indirect_offset field. * cgraphclones.c (duplicate_thunk_for_node): Deal with indirect_offset. * cgraphunit.c (cgraph_node::analyze): Be prepared for external thunks. (thunk_adjust): Add indirect_offset parameter and deal with it. (cgraph_node::expand_thunk): Deal with the indirect_offset field and pass it to thunk_adjust. Do not call the target hook if it's non-zero or if the thunk is external or local. Fix formatting. Do not chain the RESULT_DECL to BLOCK_VARS. Pass the static chain to the target, if any, in the GIMPLE representation. * ipa-icf.c (sem_function::equals_wpa): Deal with indirect_offset. * lto-cgraph.c (lto_output_node): Write indirect_offset field. (input_node): Read indirect_offset field. * tree-inline.c (expand_call_inline): Pass indirect_offset field in the call to thunk_adjust. * tree-nested.c (struct nesting_info): Add thunk_p field. (create_nesting_tree): Set it. (convert_all_function_calls): Copy static chain from targets to thunks. (finalize_nesting_tree_1): Return early for thunks. (unnest_nesting_tree_1): Do not finalize thunks. (gimplify_all_functions): Do not gimplify thunks. cp/ * method.c (use_thunk): Adjust call to cgraph_node::create_thunk. ada/ * gcc-interface/decl.c (is_cplusplus_method): Do not require C++ convention on Interfaces. * gcc-interface/trans.c (Subprogram_Body_to_gnu): Try to create a bona-fide thunk and hand it over to the middle-end. (get_controlling_type): New function. (use_alias_for_thunk_p): Likewise. (thunk_labelno): New static variable. (make_covariant_thunk): New function. (maybe_make_gnu_thunk): Likewise. * gcc-interface/utils.c (finish_subprog_decl): Set DECL_CONTEXT of the result DECL here instead of... (end_subprog_body): ...here. Co-Authored-By: Pierre-Marie de Rodat <derodat@adacore.com> From-SVN: r264701
2018-09-26[Ada] ICE on array of task type with -gnatctEric Botcazou1-1/+2
2018-09-26 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Task_Type>: In -gnatct mode, process the discriminants only for a definition. From-SVN: r264610
2018-09-26[Ada] Wrong handling of address clause for limited record typeEric Botcazou1-4/+4
2018-09-26 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Adjust code retrieving the address when a clause has already been processed. * gcc-interface/trans.c (gnat_to_gnu) <N_Attribute_Definition_Clause>: For an object with a Freeze node, build a meaningful expression. gcc/testsuite/ * gnat.dg/addr12.adb, gnat.dg/addr12_a.adb, gnat.dg/addr12_a.ads, gnat.dg/addr12_b.adb, gnat.dg/addr12_b.ads, gnat.dg/addr12_c.ads: New testcase. From-SVN: r264606
2018-08-27Come up with fndecl_built_in_p.Martin Liska1-1/+1
2018-08-27 Martin Liska <mliska@suse.cz> * builtins.h (is_builtin_fn): Remove and fndecl_built_in_p. * builtins.c (is_builtin_fn): Likewise. * attribs.c (diag_attr_exclusions): Use new function fndecl_built_in_p and remove check for FUNCTION_DECL if possible. (builtin_mathfn_code): Likewise. (fold_builtin_expect): Likewise. (fold_call_expr): Likewise. (fold_builtin_call_array): Likewise. (fold_call_stmt): Likewise. (set_builtin_user_assembler_name): Likewise. (is_simple_builtin): Likewise. * calls.c (gimple_alloca_call_p): Likewise. (maybe_warn_nonstring_arg): Likewise. * cfgexpand.c (expand_call_stmt): Likewise. * cgraph.c (cgraph_update_edges_for_call_stmt_node): Likewise. (cgraph_edge::verify_corresponds_to_fndecl): Likewise. (cgraph_node::verify_node): Likewise. * cgraphclones.c (build_function_decl_skip_args): Likewise. (cgraph_node::create_clone): Likewise. * config/arm/arm.c (arm_insert_attributes): Likewise. * config/i386/i386.c (ix86_gimple_fold_builtin): Likewise. * dse.c (scan_insn): Likewise. * expr.c (expand_expr_real_1): Likewise. * fold-const.c (operand_equal_p): Likewise. (fold_binary_loc): Likewise. * gimple-fold.c (gimple_fold_stmt_to_constant_1): Likewise. * gimple-low.c (lower_stmt): Likewise. * gimple-pretty-print.c (dump_gimple_call): Likewise. * gimple-ssa-warn-restrict.c (wrestrict_dom_walker::check_call): Likewise. * gimple.c (gimple_build_call_from_tree): Likewise. (gimple_call_builtin_p): Likewise. (gimple_call_combined_fn): Likewise. * gimplify.c (gimplify_call_expr): Likewise. (gimple_boolify): Likewise. (gimplify_modify_expr): Likewise. (gimplify_addr_expr): Likewise. * hsa-gen.c (gen_hsa_insns_for_call): Likewise. * ipa-cp.c (determine_versionability): Likewise. * ipa-fnsummary.c (compute_fn_summary): Likewise. * ipa-param-manipulation.c (ipa_modify_formal_parameters): Likewise. * ipa-split.c (visit_bb): Likewise. (split_function): Likewise. * ipa-visibility.c (cgraph_externally_visible_p): Likewise. * lto-cgraph.c (input_node): Likewise. * lto-streamer-out.c (write_symbol): Likewise. * omp-low.c (setjmp_or_longjmp_p): Likewise. (lower_omp_1): Likewise. * predict.c (strip_predict_hints): Likewise. * print-tree.c (print_node): Likewise. * symtab.c (symtab_node::output_to_lto_symbol_table_p): Likewise. * trans-mem.c (is_tm_irrevocable): Likewise. (is_tm_load): Likewise. (is_tm_simple_load): Likewise. (is_tm_store): Likewise. (is_tm_simple_store): Likewise. (is_tm_abort): Likewise. (tm_region_init_1): Likewise. * tree-call-cdce.c (gen_shrink_wrap_conditions): Likewise. * tree-cfg.c (verify_gimple_call): Likewise. (move_stmt_r): Likewise. (stmt_can_terminate_bb_p): Likewise. * tree-eh.c (lower_eh_constructs_2): Likewise. * tree-if-conv.c (if_convertible_stmt_p): Likewise. * tree-inline.c (remap_gimple_stmt): Likewise. (copy_bb): Likewise. (estimate_num_insns): Likewise. (fold_marked_statements): Likewise. * tree-sra.c (scan_function): Likewise. * tree-ssa-ccp.c (surely_varying_stmt_p): Likewise. (optimize_stack_restore): Likewise. (pass_fold_builtins::execute): Likewise. * tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Likewise. (mark_all_reaching_defs_necessary_1): Likewise. * tree-ssa-dom.c (dom_opt_dom_walker::optimize_stmt): Likewise. * tree-ssa-forwprop.c (simplify_builtin_call): Likewise. (pass_forwprop::execute): Likewise. * tree-ssa-loop-im.c (stmt_cost): Likewise. * tree-ssa-math-opts.c (pass_cse_reciprocals::execute): Likewise. * tree-ssa-sccvn.c (fully_constant_vn_reference_p): Likewise. * tree-ssa-strlen.c (get_string_length): Likewise. * tree-ssa-structalias.c (handle_lhs_call): Likewise. (find_func_aliases_for_call): Likewise. * tree-ssa-ter.c (find_replaceable_in_bb): Likewise. * tree-stdarg.c (optimize_va_list_gpr_fpr_size): Likewise. * tree-tailcall.c (find_tail_calls): Likewise. * tree.c (need_assembler_name_p): Likewise. (free_lang_data_in_decl): Likewise. (get_call_combined_fn): Likewise. * ubsan.c (is_ubsan_builtin_p): Likewise. * varasm.c (incorporeal_function_p): Likewise. * tree.h (DECL_BUILT_IN): Remove and replace with fndecl_built_in_p. (DECL_BUILT_IN_P): Transfort to fndecl_built_in_p. (fndecl_built_in_p): New. 2018-08-27 Martin Liska <mliska@suse.cz> * gcc-interface/decl.c (update_profile): Use new function fndecl_built_in_p and remove check for FUNCTION_DECL if possible. * gcc-interface/gigi.h (call_is_atomic_load): Likewise. * gcc-interface/utils.c (gnat_pushdecl): Likewise. 2018-08-27 Martin Liska <mliska@suse.cz> * c-common.c (check_function_restrict): Use new function fndecl_built_in_p and remove check for FUNCTION_DECL if possible. (check_builtin_function_arguments): Likewise. (reject_gcc_builtin): Likewise. * c-warn.c (sizeof_pointer_memaccess_warning): Likewise. 2018-08-27 Martin Liska <mliska@suse.cz> * c-decl.c (locate_old_decl): Use new function fndecl_built_in_p and remove check for FUNCTION_DECL if possible. (diagnose_mismatched_decls): Likewise. (merge_decls): Likewise. (warn_if_shadowing): Likewise. (pushdecl): Likewise. (implicitly_declare): Likewise. * c-parser.c (c_parser_postfix_expression_after_primary): Likewise. * c-tree.h (C_DECL_ISNT_PROTOTYPE): Likewise. * c-typeck.c (build_function_call_vec): Likewise. (convert_arguments): Likewise. 2018-08-27 Martin Liska <mliska@suse.cz> * call.c (build_call_a): Use new function fndecl_built_in_p and remove check for FUNCTION_DECL if possible. (build_cxx_call): Likewise. * constexpr.c (constexpr_fn_retval): Likewise. (cxx_eval_builtin_function_call): Likewise. (cxx_eval_call_expression): Likewise. (potential_constant_expression_1): Likewise. * cp-gimplify.c (cp_gimplify_expr): Likewise. (cp_fold): Likewise. * decl.c (decls_match): Likewise. (validate_constexpr_redeclaration): Likewise. (duplicate_decls): Likewise. (make_rtl_for_nonlocal_decl): Likewise. * name-lookup.c (consider_binding_level): Likewise. (cp_emit_debug_info_for_using): Likewise. * semantics.c (finish_call_expr): Likewise. * tree.c (builtin_valid_in_constant_expr_p): Likewise. 2018-08-27 Martin Liska <mliska@suse.cz> * go-gcc.cc (Gcc_backend::call_expression): Use new function fndecl_built_in_p and remove check for FUNCTION_DECL if possible. 2018-08-27 Martin Liska <mliska@suse.cz> * lto-lang.c (handle_const_attribute): Use new function fndecl_built_in_p and remove check for FUNCTION_DECL if possible. * lto-symtab.c (lto_symtab_merge_p): Likewise. (lto_symtab_merge_decls_1): Likewise. (lto_symtab_merge_symbols): Likewise. * lto.c (lto_maybe_register_decl): Likewise. (read_cgraph_and_symbols): Likewise. From-SVN: r263880