aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/utils.c
AgeCommit message (Collapse)Author
2018-06-12 * gcc-interface/ada-tree.h (TYPE_RETURN_BY_DIRECT_REF_P): Change fromEric Botcazou
using TYPE_LANG_FLAG_4 to using TYPE_LANG_FLAG_0. (TYPE_ALIGN_OK): Move around. (TYPE_PADDING_FOR_COMPONENT): Remove superfluous parentheses. * gcc-interface/decl.c (change_qualified_type): Move to... (gnat_to_gnu_entity): Adjust comment. * gcc-interface/gigi.h (change_qualified_type): ...here; make inline. (ceil_pow2): Use ceil_log2. * gcc-interface/utils.c (finish_subprog_decl): Add couple of comments and do not set TREE_SIDE_EFFECTS. (handle_noreturn_attribute): Use change_qualified_type. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@261488 138bc75d-0d04-0410-961f-82ee72b054a4
2018-06-12 Backpor from mainlineEric Botcazou
2018-06-02 Eric Botcazou <ebotcazou@adacore.com> * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Constant>: If this is not a definition, retrieve the expression only if it's a compile-time known value if we are just annotating types. * gcc-interface/utils.c (convert): Do not try to upcast properly for a conversion between tagged types in type_annotate_only mode. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@261482 138bc75d-0d04-0410-961f-82ee72b054a4
2017-11-10 * gcc-interface/utils.c (convert) <RECORD_TYPE>: Add comment and doEric Botcazou
not fall through to the next case. <ARRAY_TYPE>: Deal specially with a dereference from another array type with the same element type. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@254619 138bc75d-0d04-0410-961f-82ee72b054a4
2017-09-05 * gcc-interface/utils.c (unchecked_convert): When the result type is aEric Botcazou
non-biased integral type with size 0, set the result to 0 directly. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@251702 138bc75d-0d04-0410-961f-82ee72b054a4
2017-02-24 * gcc-interface/utils.c (fold_bit_position): New function.Eric Botcazou
(rest_of_record_type_compilation): Call it instead of bit_position to compute the field position and remove the call to remove_conversions. (compute_related_constant): Factor out the multiplication in both operands, if any, and streamline the final test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@245704 138bc75d-0d04-0410-961f-82ee72b054a4
2017-02-24 * gcc-interface/misc.c (gnat_type_max_size): Try to return a meaningfulEric Botcazou
value for array types with TYPE_INDEX_TYPE set on their domain type. * gcc-interface/utils.c (max_size): For operations and expressions, do not build a new node if the operands have not changed or are missing. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@245698 138bc75d-0d04-0410-961f-82ee72b054a4
2017-02-24 * gcc-interface/utils.c (max_size) <tcc_expression>: Flip the secondEric Botcazou
argument when recursing on TRUTH_NOT_EXPR. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@245697 138bc75d-0d04-0410-961f-82ee72b054a4
2017-01-25PR lto/79061Maxim Ostapenko
gcc/ * asan.c (get_translation_unit_decl): New function. (asan_add_global): Extract modules file name from globals TRANSLATION_UNIT_DECL name. gcc/fortran/ * f95-lang.c (gfc_create_decls): Include stringpool.h. Pass main_input_filename to build_translation_unit_decl. gcc/ada/ * gcc-interface/utils.c (get_global_context): Pass main_input_filename to build_translation_unit_decl. gcc/c/ * c-decl.c (pop_scope): Pass main_input_filename to build_translation_unit_decl. gcc/cp/ * decl.c (cxx_init_decl_processing): Pass main_input_filename to build_translation_unit_decl. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@244890 138bc75d-0d04-0410-961f-82ee72b054a4
2016-12-07Adjust commentEric Botcazou
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@243338 138bc75d-0d04-0410-961f-82ee72b054a4
2016-12-07 * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Enumeration_Subtype>:Eric Botcazou
Also call finish_character_type on Character subtypes. * gcc-interface/utils.c (finish_character_type): Deal with subtypes. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@243336 138bc75d-0d04-0410-961f-82ee72b054a4
2016-11-27 PR ada/78524Eric Botcazou
* gcc-interface/utils.c (max_size) <tcc_reference>: Add missing conversion to original type in the PLACEHOLDER_EXPR case. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@242902 138bc75d-0d04-0410-961f-82ee72b054a4
2016-11-18Add SET_DECL_MODERichard Sandiford
This may no longer be necessary with the current version of the SVE patches, but it does at least make things consistent with the TYPE_MODE/SET_TYPE_MODE split. gcc/ada/ 2016-11-16 Richard Sandiford <richard.sandiford@arm.com> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> * gcc-interface/utils.c (create_label_decl): Use SET_DECL_MODE. gcc/c/ 2016-11-16 Richard Sandiford <richard.sandiford@arm.com> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> * c-decl.c (merge_decls): Use SET_DECL_MODE. (make_label, finish_struct): Likewise. gcc/cp/ 2016-11-16 Richard Sandiford <richard.sandiford@arm.com> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> * class.c (finish_struct_bits): Use SET_DECL_MODE. (build_base_field_1, layout_class_type, finish_struct_1): Likewise. * decl.c (make_label_decl): Likewise. * pt.c (tsubst_decl): Likewise. gcc/fortran/ 2016-11-16 Richard Sandiford <richard.sandiford@arm.com> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> * trans-common.c (build_common_decl): Use SET_DECL_MODE. * trans-decl.c (gfc_build_label_decl): Likewise. * trans-types.c (gfc_get_array_descr_info): Likewise. gcc/lto/ 2016-11-16 Richard Sandiford <richard.sandiford@arm.com> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> * lto.c (offload_handle_link_vars): Use SET_DECL_MODE. gcc/ 2016-11-16 Richard Sandiford <richard.sandiford@arm.com> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> * tree.h (SET_DECL_MODE): New macro. * cfgexpand.c (avoid_deep_ter_for_debug): Use SET_DECL_MODE. (expand_gimple_basic_block): Likewise. * function.c (split_complex_args): Likeise. * ipa-prop.c (ipa_modify_call_arguments): Likewise. * omp-simd-clone.c (ipa_simd_modify_stmt_ops): Likewise. * stor-layout.c (layout_decl, relayout_decl): Likewise. (finish_bitfield_representative): Likewise. * tree.c (make_node_stat): Likewise. * tree-inline.c (remap_ssa_name): Likewise. (tree_function_versioning): Likewise. * tree-into-ssa.c (rewrite_debug_stmt_uses): Likewise. * tree-sra.c (sra_ipa_reset_debug_stmts): Likewise. * tree-ssa-ccp.c (optimize_atomic_bit_test_and): Likewise. * tree-ssa-loop-ivopts.c (remove_unused_ivs): Likewise. * tree-ssa.c (insert_debug_temp_for_var_def): Likewise. * tree-streamer-in.c (unpack_ts_decl_common_value_fields): Likewise. * varasm.c (make_debug_expr_from_rtl): Likewise. libcc1/ 2016-11-16 Richard Sandiford <richard.sandiford@arm.com> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> * plugin.cc (plugin_build_add_field): Use SET_DECL_MODE. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@242585 138bc75d-0d04-0410-961f-82ee72b054a4
2016-10-14 PR ada/77968Eric Botcazou
* gcc-interface/utils.c (create_var_decl): Do not clear TREE_READONLY in LTO mode for an external variable. (can_materialize_object_renaming_p): Move up. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@241154 138bc75d-0d04-0410-961f-82ee72b054a4
2016-10-11 * exp_dbug.adb (Debug_Renaming_Declaration): Process underlying types.Pierre-Marie de Rodat
Emit GNAT encodings for object renamings involving record components whose normalized bit offset is not null. * uintp.h (UI_No_Uint): Declare. * gcc-interface/gigi.h (can_materialize_object_renaming_p): New. * gcc-interface/utils.c (can_materialize_object_renaming_p): New function. * gcc-interface/trans.c (gnat_to_gnu) <N_Object_Renaming_Declaration>: In code generation mode, materialize all renamings as long as they need debug info and we are not optimizing. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@240985 138bc75d-0d04-0410-961f-82ee72b054a4
2016-10-11 * gcc-interface/utils.c (type_unsigned_for_rm): New predicate.Eric Botcazou
(make_type_from_size): Use it. (unchecked_convert): Likewise. Do not skip the extension step if the source type is not integral. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@240975 138bc75d-0d04-0410-961f-82ee72b054a4
2016-10-10 * gcc-interface/utils.c (convert): For a biased input type, convertEric Botcazou
the bias itself to the base type before adding it. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@240910 138bc75d-0d04-0410-961f-82ee72b054a4
2016-10-08 * gcc-interface/utils.c (convert) <VECTOR_CST>: Add missing break.Eric Botcazou
Revert 2016-09-26 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> * gcc-interface/decl.c: Fix fall through comment formatting. * gcc-interface/misc.c: Likewise. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. * gcc-interface/utils2.c: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@240890 138bc75d-0d04-0410-961f-82ee72b054a4
2016-09-26Fix fallthrough comments for Ada, Solaris/x86, SPARCRainer Orth
gcc: * config/i386/i386.c (ix86_print_operand) [HAVE_AS_IX86_CMOV_SUN_SYNTAX]: Add gcc_fallthrough. * config/sparc/sparc.c (check_pic): Add fallthrough comment. (epilogue_renumber): Likewise. gcc/ada: * gcc-interface/decl.c: Fix fall through comment formatting. * gcc-interface/misc.c: Likewise. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. * gcc-interface/utils2.c: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@240509 138bc75d-0d04-0410-961f-82ee72b054a4
2016-07-11 * gcc-interface/trans.c (add_decl_expr): Minor tweak.Eric Botcazou
* gcc-interface/utils.c (create_var_decl): For an external variable, also clear TREE_READONLY in LTO mode if the initializer is not a valid constant and set DECL_READONLY_ONCE_ELAB instead. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@238206 138bc75d-0d04-0410-961f-82ee72b054a4
2016-06-29 PR ada/48835Eric Botcazou
PR ada/61954 * gcc-interface/gigi.h (enum standard_datatypes): Add ADT_realloc_decl (realloc_decl): New macro. * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Use local variable for the entity type and translate it as void pointer if the entity has convention C. (gnat_to_gnu_entity) <E_Function>: If this is not a definition and the external name matches that of malloc_decl or realloc_decl, return the correspoding node directly. (gnat_to_gnu_subprog_type): Likewise for parameter and return types. * gcc-interface/trans.c (gigi): Initialize void_list_node here, not... Initialize realloc_decl. * gcc-interface/utils.c (install_builtin_elementary_types): ...here. (build_void_list_node): Delete. * gcc-interface/utils2.c (known_alignment) <CALL_EXPR>: Return the alignment of the system allocator for malloc_decl and realloc_decl. Do not take alignment from void pointer types either. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237850 138bc75d-0d04-0410-961f-82ee72b054a4
2016-06-21 * tree.c (verify_type_variant): Skip TYPE_SIZE and TYPE_SIZE_UNIT ifEric Botcazou
they are both PLACEHOLDER_EXPRs. ada/ * gcc-interface/decl.c (set_nonaliased_component_on_array_type): New function. (set_reverse_storage_order_on_array_type): Likewise. (gnat_to_gnu_entity) <E_Array_Type>: Call them to set the flags. <E_Array_Subtype>: Likewise. <E_String_Literal_Subtype>: Likewise. (substitute_in_type) <ARRAY_TYPE>: Likewise. * gcc-interface/utils.c (gnat_pushdecl): Always create a variant for the DECL_ORIGINAL_TYPE of a type. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237658 138bc75d-0d04-0410-961f-82ee72b054a4
2016-06-10PR c/71392 - SEGV calling integer overflow built-ins with a null pointerMartin Sebor
gcc/ChangeLog: 2016-06-10 Martin Sebor <msebor@redhat.com> PR c/71392 * builtin-attrs.def (ATTR_NOTHROW_NONNULL_LEAF_LIST): New macro. (ATTR_NOTHROW_NONNULL_TYPEGENERIC_LEAF): Same. * builtins.def (BUILT_IN_SADD_OVERFLOW, BUILT_IN_SADDL_OVERFLOW): Use them. (BUILT_IN_SADDLL_OVERFLOW, BUILT_IN_SSUB_OVERFLOW): Same. (BUILT_IN_SSUBL_OVERFLOW, BUILT_IN_SSUBLL_OVERFLOW): Same. (BUILT_IN_SMUL_OVERFLOW, BUILT_IN_SMULL_OVERFLOW): Same. (BUILT_IN_SMULLL_OVERFLOW, BUILT_IN_UADD_OVERFLOW): Same. (BUILT_IN_UADDL_OVERFLOW, BUILT_IN_UADDLL_OVERFLOW): Same. (BUILT_IN_USUB_OVERFLOW, BUILT_IN_USUBL_OVERFLOW): Same. (BUILT_IN_USUBLL_OVERFLOW, BUILT_IN_UMUL_OVERFLOW): Same. (BUILT_IN_UMULL_OVERFLOW, BUILT_IN_UMULLL_OVERFLOW): gcc/ada/ChangeLog: 2016-06-10 Martin Sebor <msebor@redhat.com> PR c/71392 * gcc/ada/gcc-interface/utils.c (handle_nonnull_attribute): Accept the nonnull attribute in type-generic builtins. gcc/c-family/ChangeLog: 2016-06-10 Martin Sebor <msebor@redhat.com> PR c/71392 * gcc/c-family/c-common.c (handle_nonnull_attribute): Accept the nonnull attribute in type-generic builtins. gcc/lto/ChangeLog: 2016-06-10 Martin Sebor <msebor@redhat.com> PR c/71392 * gcc/lto/lto-lang.c (handle_nonnull_attribute): Accept the nonnull attribute in type-generic builtins. gcc/testsuite/ChangeLog: 2016-06-10 Martin Sebor <msebor@redhat.com> PR c/71392 * c-c++-common/builtin-arith-overflow-1.c: Add test cases. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237314 138bc75d-0d04-0410-961f-82ee72b054a4
2016-06-06 * gcc-interface/utils.c (gnat_internal_attribute_table): Add supportEric Botcazou
for noinline and noclone attributes. (handle_noinline_attribute): New handler. (handle_noclone_attribute): Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237127 138bc75d-0d04-0410-961f-82ee72b054a4
2016-06-06 * gcc-interface/gigi.h (finish_subprog_decl): Add ASM_NAME parameter.Eric Botcazou
* gcc-interface/decl.c (gnu_ext_name_for_subprog): New function. (gnat_to_gnu_entity) <E_Subprogram_Type>: Do not check compatibility of profiles for builtins here... Call gnu_ext_name_for_subprog. Also update profiles if pointers to limited_with'ed types are updated. (gnat_to_gnu_param): Restore the correct source location information for vector ABI warnings. (associate_subprog_with_dummy_type): Add comment about AI05-019. Set TYPE_DUMMY_IN_PROFILE_P flag unconditionally. (update_profile): Deal with builtin declarations. Call gnu_ext_name_for_subprog. Adjust call to finish_subprog_decl. (update_profiles_with): Add comment. (gnat_to_gnu_subprog_type): Reuse the return type if it is complete. Likewise for parameter declarations in most cases. Do not change the return type for the CICO mechanism if the profile is incomplete. ...but here instead. Always reset the slot for the parameters. * gcc-interface/utils.c (create_subprog_decl): Call gnu_ext_name_for_subprog. Do not set the assembler name here but... (finish_subprog_decl): ...but here instead. Add ASM_NAME parameter. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@237119 138bc75d-0d04-0410-961f-82ee72b054a4
2016-05-20 * tree-vrp.c (compare_values_warnv): Simplify handling of symbolicEric Botcazou
ranges by calling get_single_symbol and tidy up. Look more closely into NAME + CST1 vs CST2 comparisons if type overflow is undefined. ada/ * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Signed_Integer_Subtype>: Make same-sized subtypes of signed base types signed. * gcc-interface/utils.c (make_type_from_size): Adjust to above change. (unchecked_convert): Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@236548 138bc75d-0d04-0410-961f-82ee72b054a4
2016-05-16 * doc/gnat_rm/implementation_defined_attributes.rstEric Botcazou
(Scalar_Storage_Order): Adjust restriction for packed array types. * einfo.ads (Is_Bit_Packed_Array): Adjust description. (Is_Packed): Likewise. (Is_Packed_Array_Impl_Type): Likewise. (Packed_Array_Impl_Type): Likewise. * exp_ch4.adb (Expand_N_Indexed_Component): Do not do anything special if the prefix is not a packed array implemented specially. * exp_ch6.adb (Expand_Actuals): Expand indexed components only for bit-packed array types. * exp_pakd.adb (Install_PAT): Set Is_Packed_Array_Impl_Type flag on the PAT before analyzing its declaration. (Create_Packed_Array_Impl_Type): Remove redundant statements. * freeze.adb (Check_Component_Storage_Order): Reject packed array components only if they are bit packed. (Freeze_Array_Type): Fix logic detecting bit packing and do not bit pack for composite types whose size is multiple of a byte. Create the implementation type for packed array types only when it is needed, i.e. bit packing or packing because of holes in index types. Make sure the Has_Non_Standard_Rep and Is_Packed flags agree. * gcc-interface/gigi.h (make_packable_type): Add MAX_ALIGN parameter. * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Signed_Integer_Subtype>: Call maybe_pad_type instead of building the padding type manually. (gnat_to_gnu_entity) <E_Array_Subtype>: Do not assert that Packed_Array_Impl_Type is present for packed arrays. (gnat_to_gnu_component_type): Also handle known alignment for packed types by passing it to make_packable_type. * gcc-interface/utils.c (make_packable_type): Add MAX_ALIGN parameter and deal with it in the array case. Adjust recursive call. Simplify computation of new size and cap the alignment to BIGGEST_ALIGNMENT. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@236279 138bc75d-0d04-0410-961f-82ee72b054a4
2016-04-27 * sem_aux.adb (Is_By_Reference_Type): Also return true for a taggedEric Botcazou
incomplete type without full view. * sem_ch6.adb (Exchange_Limited_Views): Change into a function and return the list of changes. (Restore_Limited_Views): New procedure to undo the transformation made by Exchange_Limited_Views. (Analyze_Subprogram_Body_Helper): Adjust call to Exchange_Limited_Views and call Restore_Limited_Views at the end, if need be. (Possible_Freeze): Do not delay freezing because of incomplete types. (Process_Formals): Remove kludges for class-wide types. * types.h (By_Copy_Return): Delete. * gcc-interface/ada-tree.h (TYPE_MAX_ALIGN): Move around. (TYPE_DUMMY_IN_PROFILE_P): New macro. * gcc-interface/gigi.h (update_profiles_with): Declare. (finish_subprog_decl): Likewise. (get_minimal_subprog_decl): Delete. (create_subprog_type): Likewise. (create_param_decl): Adjust prototype. (create_subprog_decl): Likewise. * gcc-interface/decl.c (defer_limited_with): Rename into... (defer_limited_with_list): ...this. (gnat_to_gnu_entity): Adjust to above renaming. (finalize_from_limited_with): Likewise. (tree_entity_vec_map): New structure. (gt_pch_nx): New helpers. (dummy_to_subprog_map): New hash table. (gnat_to_gnu_param): Set the SLOC here. Remove MECH parameter and add FIRST parameter. Deal with the mechanism here instead of... Do not make read-only variant of types. Simplify expressions. In the by-ref case, test the mechanism before must_pass_by_ref and also TYPE_IS_BY_REFERENCE_P before building the reference type. (gnat_to_gnu_subprog_type): New static function extracted from... Do not special-case the type_annotate_only mode. Call gnat_to_gnu_profile_type instead of gnat_to_gnu_type on return type. Deal with dummy return types. Likewise for parameter types. Deal with by-reference types explicitly and add a kludge for null procedures with untagged incomplete types. Remove assertion on the types and be prepared for multiple elaboration of the declarations. Skip the whole CICO processing if the profile is incomplete. Handle the completion of a previously incomplete profile. (gnat_to_gnu_entity) <E_Variable>: Rename local variable. Adjust couple of calls to create_param_decl. <E_Access_Subprogram_Type, E_Anonymous_Access_Subprogram_Type>: Remove specific deferring code. <E_Access_Type>: Also deal with E_Subprogram_Type designated type. Simplify handling of dummy types and remove obsolete comment. Constify a couple of variables. Do not set TYPE_UNIVERSAL_ALIASING_P on dummy types. <E_Access_Subtype>: Tweak comment and simplify condition. <E_Subprogram_Type>: ...here. Call it and clean up handling. Remove obsolete comment and adjust call to gnat_to_gnu_param. Adjust call to create_subprog_decl. <E_Incomplete_Type>: Add a couple of 'const' qualifiers and get rid of inner break statements. Tidy up condition guarding direct use of the full view. (get_minimal_subprog_decl): Delete. (finalize_from_limited_with): Call update_profiles_with on dummy types with TYPE_DUMMY_IN_PROFILE_P set. (is_from_limited_with_of_main): Delete. (associate_subprog_with_dummy_type): New function. (update_profile): Likewise. (update_profiles_with): Likewise. (gnat_to_gnu_profile_type): Likewise. (init_gnat_decl): Initialize dummy_to_subprog_map. (destroy_gnat_decl): Destroy dummy_to_subprog_map. * gcc-interface/misc.c (gnat_get_alias_set): Add guard for accessing TYPE_UNIVERSAL_ALIASING_P. (gnat_get_array_descr_info): Minor tweak. * gcc-interface/trans.c (gigi): Adjust calls to create_subprog_decl. (build_raise_check): Likewise. (Compilation_Unit_to_gnu): Likewise. (Identifier_to_gnu): Accept mismatches coming from a limited context. (Attribute_to_gnu): Remove kludge for dispatch table entities. (process_freeze_entity): Do not retrieve old definition if there is an address clause on the entity. Call update_profiles_with on dummy types with TYPE_DUMMY_IN_PROFILE_P set. * gcc-interface/utils.c (build_dummy_unc_pointer_types): Also set TYPE_REFERENCE_TO to the fat pointer type. (create_subprog_type): Delete. (create_param_decl): Remove READONLY parameter. (finish_subprog_decl): New function extracted from... (create_subprog_decl): ...here. Call it. Remove CONST_FLAG and VOLATILE_FLAG parameters and adjust. (update_pointer_to): Also clear TYPE_REFERENCE_TO in the unconstrained case. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@235521 138bc75d-0d04-0410-961f-82ee72b054a4
2016-04-27 * gcc-interface/gigi.h (gnat_to_gnu_entity): Adjust prototype.Eric Botcazou
(maybe_pad_type): Adjust comment. (finish_record_type): Likewise. (rest_of_record_type_compilation): Likewise. * gcc-interface/decl.c (gnat_to_gnu_entity): Change DEFINITION type parameter from integer to boolean. Adjust recursive calls. <E_Subprogram_Type>: Use copy_type and remove redundant assignments. <E_Signed_Integer_Subtype>: Adjust comment. Remove call to rest_of_record_type_compilation. Set TYPE_PADDING_P flag earlier. Pass false to finish_record_type. Set the debug type later. <E_Record_Subtype>: Remove call to rest_of_record_type_compilation. (gnat_to_gnu_component_type): Fix formatting. (gnat_to_gnu_field_decl): Adjust call to gnat_to_gnu_entity. (gnat_to_gnu_type): Likewise. * gcc-interface/trans.c (Identifier_to_gnu): Likewise. (Loop_Statement_to_gnu): Likewise. (Subprogram_Body_to_gnu): Likewise. (Exception_Handler_to_gnu_fe_sjlj): Likewise. (Exception_Handler_to_gnu_gcc): Likewise. (Compilation_Unit_to_gnu): Likewise. (gnat_to_gnu): Likewise. (push_exception_label_stack): Likewise. (elaborate_all_entities_for_package): Likewise. (process_freeze_entity): Likewise. (process_decls): Likewise. (process_type): Likewise. * gcc-interface/utils.c (struct deferred_decl_context_node): Tweak. (maybe_pad_type): Adjust comments. Set the debug type later. Remove call to rest_of_record_type_compilation. (rest_of_record_type_compilation): Use copy_type. (copy_type): Use correctly typed constants. (gnat_signed_or_unsigned_type_for): Use copy_type. * gcc-interface/utils2.c (nonbinary_modular_operation): Likewise. (build_goto_raise): Adjust call tognat_to_gnu_entity. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@235479 138bc75d-0d04-0410-961f-82ee72b054a4
2016-04-18 * tree.h (TYPE_ALIGN, DECL_ALIGN): Return shifted amount.Michael Matz
(SET_TYPE_ALIGN, SET_DECL_ALIGN): New. * tree-core.h (tree_type_common.align): Use bit-field. (tree_type_common.spare): New. (tree_decl_common.off_align): Make smaller. (tree_decl_common.align): Use bit-field. * expr.c (expand_expr_addr_expr_1): Use SET_TYPE_ALIGN. * omp-low.c (install_var_field): Use SET_DECL_ALIGN. (scan_sharing_clauses): Ditto. (finish_taskreg_scan): Use SET_DECL_ALIGN and SET_TYPE_ALIGN. (omp_finish_file): Ditto. * stor-layout.c (do_type_align): Use SET_DECL_ALIGN. (layout_decl): Ditto. (relayout_decl): Ditto. (finalize_record_size): Use SET_TYPE_ALIGN. (finalize_type_size): Ditto. (finish_builtin_struct): Ditto. (layout_type): Ditto. (initialize_sizetypes): Ditto. * targhooks.c (std_gimplify_va_arg_expr): Use SET_TYPE_ALIGN. * tree-nested.c (insert_field_into_struct): Use SET_TYPE_ALIGN. (lookup_field_for_decl): Use SET_DECL_ALIGN. (get_chain_field): Ditto. (get_trampoline_type): Ditto. (get_nl_goto_field): Ditto. * tree-streamer-in.c (unpack_ts_decl_common_value_fields): Use SET_DECL_ALIGN. (unpack_ts_type_common_value_fields): Use SET_TYPE_ALIGN. * gimple-expr.c (copy_var_decl): Use SET_DECL_ALIGN. * tree.c (make_node_stat): Use SET_DECL_ALIGN and SET_TYPE_ALIGN. (build_qualified_type): Use SET_TYPE_ALIGN. (build_aligned_type, build_range_type_1): Ditto. (build_atomic_base): Ditto. (build_common_tree_nodes): Ditto. * cfgexpand.c (align_local_variable): Use SET_DECL_ALIGN. (expand_one_stack_var_at): Ditto. * coverage.c (build_var): Use SET_DECL_ALIGN. * except.c (init_eh): Ditto. * function.c (assign_parm_setup_block): Ditto. * symtab.c (increase_alignment_1): Ditto. * tree-ssa-ccp.c (fold_builtin_alloca_with_align): Ditto. * tree-vect-stmts.c (ensure_base_align): Ditto. * varasm.c (align_variable): Ditto. (assemble_variable): Ditto. (build_constant_desc): Ditto. (output_constant_def_contents): Ditto. * config/arm/arm.c (arm_relayout_function): Use SET_DECL_ALIGN. * config/avr/avr.c (avr_adjust_type_node): Use SET_TYPE_ALIGN. * config/mips/mips.c (mips_std_gimplify_va_arg_expr): Ditto. * config/msp430/msp430.c (msp430_gimplify_va_arg_expr): Ditto. * config/spu/spu.c (spu_build_builtin_va_list): Use SET_DECL_ALIGN. ada/ * gcc-interface/decl.c (gnat_to_gnu_entity): Use SET_TYPE_ALIGN. (gnat_to_gnu_field): Ditto. (components_to_record): Ditto. (create_variant_part_from): Ditto. (copy_and_substitute_in_size): Ditto. (substitute_in_type): Ditto. * gcc-interface/utils.c (make_aligning_type): Use SET_TYPE_ALIGN. (make_packable_type): Ditto. (maybe_pad_type): Ditto. (finish_fat_pointer_type): Ditto. (finish_record_type): Ditto and use SET_DECL_ALIGN. (rest_of_record_type_compilation): Use SET_TYPE_ALIGN. (create_field_decl): Use SET_DECL_ALIGN. c-family/ * c-common.c (handle_aligned_attribute): Use SET_TYPE_ALIGN and SET_DECL_ALIGN. c/ * c-decl.c (merge_decls): Use SET_DECL_ALIGN and SET_TYPE_ALIGN. (grokdeclarator, parser_xref_tag, finish_enum): Use SET_TYPE_ALIGN. cp/ * class.c (build_vtable): Use SET_DECL_ALIGN and SET_TYPE_ALIGN. (layout_class_type): Ditto. (build_base_field): Use SET_DECL_ALIGN. (fixup_attribute_variants): Use SET_TYPE_ALIGN. * decl.c (duplicate_decls): Use SET_DECL_ALIGN. (record_unknown_type): Use SET_TYPE_ALIGN. (cxx_init_decl_processing): Ditto. (copy_type_enum): Ditto. (grokfndecl): Use SET_DECL_ALIGN. (copy_type_enum): Use SET_TYPE_ALIGN. * pt.c (instantiate_class_template_1): Use SET_TYPE_ALIGN. (tsubst): Ditto. * tree.c (cp_build_qualified_type_real): Use SET_TYPE_ALIGN. * lambda.c (maybe_add_lambda_conv_op): Use SET_DECL_ALIGN. * method.c (implicitly_declare_fn): Use SET_DECL_ALIGN. * rtti.c (emit_tinfo_decl): Ditto. fortran/ * trans-io.c (gfc_build_io_library_fndecls): Use SET_TYPE_ALIGN. * trans-common.c (build_common_decl): Use SET_DECL_ALIGN. * trans-types.c (gfc_add_field_to_struct): Use SET_DECL_ALIGN. go/ * go-gcc.cc (Gcc_backend::implicit_variable): Use SET_DECL_ALIGN. java/ * class.c (add_method_1): Use SET_DECL_ALIGN. (make_class_data): Ditto. (emit_register_classes_in_jcr_section): Ditto. * typeck.c (build_java_array_type): Ditto. objc/ * objc-act.c (objc_build_struct): Use SET_DECL_ALIGN. libcc1/ * plugin.cc (plugin_finish_record_or_union): Use SET_TYPE_ALIGN. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@235172 138bc75d-0d04-0410-961f-82ee72b054a4
2016-02-29Replace ENABLE_CHECKING macro with flag_checking in GNATMartin Liska
* gcc-interface/utils.c (set_reverse_storage_order_on_pad_type): Replace ENABLE_CHECKING macro with flag_checking. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@233815 138bc75d-0d04-0410-961f-82ee72b054a4
2016-02-29 * gcc-interface/ada-tree.h (DECL_RETURN_VALUE_P): New macro.Eric Botcazou
* gcc-interface/gigi.h (gigi): Remove useless attribute. (gnat_gimplify_expr): Likewise. (gnat_to_gnu_external): Declare. * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Constant>: Factor out code dealing with the expression of external constants into... Invoke gnat_to_gnu_external instead. <E_Variable>: Invoke gnat_to_gnu_external to translate renamed objects when not for a definition. Deal with COMPOUND_EXPR and variables with DECL_RETURN_VALUE_P set for renamings and with the case of a dangling 'reference to a function call in a renaming. Remove obsolete test and adjust associated comment. * gcc-interface/trans.c (Call_to_gnu): Set DECL_RETURN_VALUE_P on the temporaries created to hold the return value, if any. (gnat_to_gnu_external): ...this. New function. * gcc-interface/utils.c (create_var_decl): Detect a constant created to hold 'reference to function call. * gcc-interface/utils2.c (build_unary_op) <ADDR_EXPR>: Add folding for COMPOUND_EXPR in the DECL_RETURN_VALUE_P case. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@233804 138bc75d-0d04-0410-961f-82ee72b054a4
2016-02-16 * gcc-interface/gigi.h (maybe_debug_type): New inline function.Eric Botcazou
* gcc-interface/misc.c (gnat_get_array_descr_info): Use it. Call maybe_character_value on the array bounds. Get to the base type of the index type and call maybe_debug_type on it. * gcc-interface/utils.c (finish_character_type): Add special treatment git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@233469 138bc75d-0d04-0410-961f-82ee72b054a4
2016-02-08 * gcc-interface/utils.c (create_var_decl): Set again DECL_COMMON andEric Botcazou
DECL_IGNORED_P last. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@233210 138bc75d-0d04-0410-961f-82ee72b054a4
2016-01-20 * exp_ch2.adb (Expand_Current_Value): Make an appropriate characterEric Botcazou
literal if the entity is of a character type. * gcc-interface/lang.opt (fsigned-char): New option. * gcc-interface/misc.c (gnat_handle_option): Accept it. (gnat_init): Adjust comment. * gcc-interface/gigi.h (finish_character_type): New prototype. (maybe_character_type): New inline function. (maybe_character_value): Likewise. * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Enumeration_Type>: For a character of CHAR_TYPE_SIZE, make a signed type if flag_signed_char. Set TYPE_ARTIFICIAL early and call finish_character_type on the type. <E_Enumeration_Subtype>: For a subtype of character with RM_Size and Esize equal to CHAR_TYPE_SIZE, make a signed type if flag_signed_char. Copy TYPE_STRING_FLAG from type to subtype. <E_Array_Type>: Deal with character index types. <E_Array_Subtype>: Likewise. * gcc-interface/trans.c (gigi): Replace unsigned_char_type_node with char_type_node throughout. (build_raise_check): Likewise. (get_type_length): Deal with character types. (Attribute_to_gnu) <Attr_Pos>: Likewise. Remove obsolete range check code. Minor tweak. <Attr_Pred>: Likewise. (Loop_Statement_to_gnu): Likewise. (Raise_Error_to_gnu): Likewise. <N_Indexed_Component>: Deal with character index types. Remove obsolete code. <N_Slice>: Likewise. <N_Type_Conversion>: Deal with character types. Minor tweak. <N_Unchecked_Type_Conversion>: Likewise. <N_In>: Likewise. <N_Op_Eq>: Likewise. (emit_index_check): Delete. * gcc-interface/utils.c (finish_character_type): New function. (gnat_signed_or_unsigned_type_for): Deal with built-in character types. * gcc-interface/utils2.c (expand_sloc): Replace unsigned_char_type_node with char_type_node. (build_call_raise): Likewise. (build_call_raise_column): Likewise. (build_call_raise_range): Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@232604 138bc75d-0d04-0410-961f-82ee72b054a4
2016-01-18 * gcc-interface/gigi.h (build_call_raise_column): Adjust prototype.Eric Botcazou
(build_call_raise_range): Likewise. (gnat_unsigned_type): Delete. (gnat_signed_type): Likewise. (gnat_signed_or_unsigned_type_for): New prototype. (gnat_unsigned_type_for): New inline function. (gnat_signed_type_for): Likewise. * gcc-interface/cuintp.c (build_cst_from_int): Call build_int_cst. * gcc-interface/decl.c (gnat_to_gnu_entity): Likewise. (gnat_to_gnu_entity) <E_Array_Type>: Always translate the index types and compute their base type from that. <E_Array_Subtype>: Remove duplicate declaration. * gcc-interface/misc.c (get_array_bit_stride): Call build_int_cst. * gcc-interface/trans.c (get_type_length): Likewise. (Attribute_to_gnu): Likewise. (Loop_Statement_to_gnu): Likewise. (Call_to_gnu): Likewise. (gnat_to_gnu): Call build_real, build_int_cst, gnat_unsigned_type_for and gnat_signed_type_for. Minor tweaks. (build_binary_op_trapv): Likewise. (emit_check): Likewise. (convert_with_check): Likewise. (Raise_Error_to_gnu): Adjust calls to the build_call_raise family of functions. Minor tweaks. (Case_Statement_to_gnu): Remove dead code. (gnat_to_gnu): Call gnat_unsigned_type_for and gnat_signed_type_for. (init_code_table): Minor reordering. * gcc-interface/utils.c (gnat_unsigned_type): Delete. (gnat_signed_type): Likewise. (gnat_signed_or_unsigned_type_for): New function. (unchecked_convert): Use directly the size in the test for precision vs size adjustments. (install_builtin_elementary_types): Call gnat_signed_type_for. * gcc-interface/utils2.c (nonbinary_modular_operation): Call build_int_cst. (build_goto_raise): New function taken from... (build_call_raise): ...here. Call it. (build_call_raise_column): Add KIND parameter and call it. (build_call_raise_range): Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@232503 138bc75d-0d04-0410-961f-82ee72b054a4
2016-01-18 * gcc-interface/ada-tree.h (TYPE_IMPLEMENTS_PACKED_ARRAY_P): Rename toEric Botcazou
(TYPE_IMPL_PACKED_ARRAY_P): ...this. (TYPE_CAN_HAVE_DEBUG_TYPE_P): Do not test TYPE_DEBUG_TYPE. * gcc-interface/decl.c (gnat_to_gnu_entity): Simplify NULL_TREE tests and tweak gnat_encodings tests throughout. (initial_value_needs_conversion): Likewise. (intrin_arglists_compatible_p): Likewise. * gcc-interface/misc.c (gnat_print_type): Likewise. (gnat_get_debug_type): Likewise. (gnat_get_fixed_point_type_info): Likewise. (gnat_get_array_descr_info): Likewise. (get_array_bit_stride): Likewise. (gnat_get_type_bias): Fix formatting. (enumerate_modes): Likewise. * gcc-interface/trans.c (gnat_to_gnu): Likewise. (add_decl_expr): Simplify NULL_TREE test. (end_stmt_group): Likewise. (build_binary_op_trapv): Fix formatting. (get_exception_label): Use switch statement. (init_code_table): Move around. * gcc-interface/utils.c (global_bindings_p): Simplify NULL_TREE test. (gnat_poplevel): Likewise. (gnat_set_type_context): Likewise. (defer_or_set_type_context): Fix formatting. (gnat_pushdecl): Simplify NULL_TREE test. (maybe_pad_type): Likewise. (add_parallel_type): Likewise. (create_range_type): Likewise. (process_deferred_decl_context): Likewise. (convert): Likewise. (def_builtin_1): Likewise. * gcc-interface/utils2.c (find_common_type): Likewise. (build_binary_op): Likewise. (gnat_rewrite_reference): Likewise. (get_inner_constant_reference): Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@232501 138bc75d-0d04-0410-961f-82ee72b054a4
2016-01-06Ada: add XVE/XVU parallel types to lexical scopesPierre-Marie de Rodat
This change adds TYPE_DECL nodes for XVE/XVU parallel types to lexical scopes so that these types are properly scoped in the debug information. gcc/ada/ChangeLog: * gcc-interface/utils.c: Bump copyright year. (rest_of_record_type_compilation): Add XVE/XVU parallel types to the current lexical scope. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@232098 138bc75d-0d04-0410-961f-82ee72b054a4
2015-12-20 * gcc-interface/utils.c (maybe_pad_type): In type_annotate_only mode,Eric Botcazou
retrieve the component type if this is an array and do not issue the warning for concurrent types. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@231859 138bc75d-0d04-0410-961f-82ee72b054a4
2015-12-17DWARF: describe properly Ada packed arraysPierre-Marie de Rodat
gcc/ada/ChangeLog: * gcc-interface/ada-tree.h (TYPE_IMPLEMENTS_PACKED_ARRAY_P, TYPE_CAN_HAVE_DEBUG_TYPE_P, TYPE_ORIGINAL_PACKED_ARRAY, SET_TYPE_ORIGINAL_PACKED_ARRAY): New macros. * gcc-interface/decl.c (add_parallel_type_for_packed_array): Rename to associate_original_type_to_packed_array. When -fgnat-encodings=minimal, set original packed array type as so instead of as a parallel type to the implementation type. In this case, also rename the implementation type to the name of the original array type. (gnat_to_gnu_entity): Update invocations to add_parallel_type_for_packed_array. Tag ARRAY_TYPE nodes for packed arrays with the TYPE_PACKED flag. When -fgnat-encodings=minimal: - strip ___XP suffixes in packed arrays' names; - set the debug type for padding records around packed arrays to the packed array; - do not attach ___XUP types as parallel types of constrained array types. * gcc-interface/misc.c (gnat_print_type): Update to handle orignal packed arrays. (gnat_get_debug_type): Update to reject packed arrays implementation types. (get_array_bit_stride): New. (gnat_get_array_descr_info): Add packed arrays handling. * gcc-interface/utils.c (maybe_pad_type): When -fgnat-encodings=minimal, set the name of the padding type to the one of the original packed type, if any. Fix TYPE_DECL peeling around the name of the input type. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@231768 138bc75d-0d04-0410-961f-82ee72b054a4
2015-12-17DWARF: add a language hook to override types in debugging informationPierre-Marie de Rodat
Many artificial types are introduced by GNAT in order to satisfy constraints in GCC's internal trees or to generate optimal code. These hide original types from sources and miss useful information in the debugging information or add noise to it and make debugging confusing. This change introduces a new language hook to give a chance to front-ends to restore the source types in the debugging information. This change also enhance the array descriptor language hook to handle array-wide bit/byte stride. Some arrays may contain dynamically-sized objects. Debuggers need for these a hint to know the size allocated for each element, hence the need for the array-wide bit/byte stride. The Ada front-end is enhanced to take advantage of both hooks when -fgnat-encodings=minimal, in order to keep compatibility with GDB. gcc/ada/ChangeLog: * gcc-interface/ada-tree.h (struct lang_type): Rename the t field as t1 and add a t2 one. (get_lang_specific): New. (GET_TYPE_LANG_SPECIFIC): Refactor to use get_lang_specific. (SET_TYPE_LANG_SPECIFIC): Likewise. (GET_TYPE_LANG_SPECIFIC2): New macro. (SET_TYPE_LANG_SPECIFIC2): New macro. (TYPE_DEBUG_TYPE): New macro. (SET_TYPE_DEBUG_TYPE): New macro. * gcc-interface/decl.c (gnat_to_gnu_entity): When -fgnat-encodings=minimal, set padding types' debug type to the padded one (i.e. strip ___PAD GNAT encodings) and set constrained record subtypes's debug type to the base type. * gcc-interface/misc.c (gnat_print_type): Print debug types. (gnat_get_debug_type): New. (gnat_get_array_descr_info): When -fgnat-encodings=minimal, set a byte stride for arrays that contain a type whose debug type has variable length. (LANG_HOOKS_GET_DEBUG_TYPE): Redefine macro to implement the debug type language hook. * gcc-interface/utils.c (maybe_pad_type): When -fgnat-encodings=minimal, set padding types' debug type to the padded one. Restore XVZ variables creation when -fgnat-encodings-minimal and use them to hold padding types' byte size. For library-level padding types, share this variable across translation units. Tag XVZ variables as artificial. gcc/ChangeLog: * langhooks.h (struct lang_hooks_for_types): Add a get_debug_type field. * langhooks-def.h (LANG_HOOKS_GET_DEBUG_TYPE): New macro. (LANG_HOOKS_FOR_TYPES_INITIALIZER): Initialize the get_debug_type field. * dwarf2out.h (struct array_descr_info): Add an array-wide stride field. * dwarf2out.c (modified_type_die): Invoke the get_debug_type language hook, process its result instead, if any. (gen_descr_array_type_die): Add array-wide stride processing. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@231763 138bc75d-0d04-0410-961f-82ee72b054a4
2015-12-17DWARF: handle variable-length records and variant partsPierre-Marie de Rodat
Enhance the DWARF back-end to emit proper descriptions for variable-length records as well as variant parts in records. In order to achieve this, generate DWARF expressions ("location descriptions" in dwarf2out's parlance) for size and data member location attributes. Also match QUAL_UNION_TYPE data types as variant parts, assuming the formers appear only to implement the latters (which is the case at the moment: only the Ada front-end emits them). Note that very few debuggers can handle these descriptions (GDB does not yet), so in order to ease the the transition enable these only when -fgnat-encodings=minimal. gcc/ada/ChangeLog: * gcc-interface/decl.c (gnat_to_gnu_entity): Disable ___XVS GNAT encodings when -fgnat-encodings=minimal. (components_to_record): Disable ___XVE, ___XVN, ___XVU and ___XVZ GNAT encodings when -fgnat-encodings=minimal. * gcc-interface/utils.c (maybe_pad_type): Disable __XVS GNAT encodings when -fgnat-encodings=minimal. gcc/ChangeLog: * debug.h (struct gcc_debug_hooks): Add a new size_function hook. * debug.c (do_nothing_debug_hooks): Set the size_function field to no-op. * dbxout.c (dbx_debug_hooks, xcoff_debug_hooks): Likewise. * sdbout.c (sdb_debug_hooks): Likewise. * vmsdbgout.c (vmsdbg_debug_hooks): Likewise. * stor-layout.c (finalize_size_functions): Let the debug info back-end know about the implementation of size functions. * dwarf2out.h (dw_discr_list_ref): New typedef. (enum dw_val_class): Add value classes for discriminant values and discriminant lists. (struct dw_discr_value): New structure. (struct dw_val_node): Add discriminant values and discriminant lists to the union. (struct dw_loc_descr_node): Add frame_offset_rel and dw_loc_frame_offset (only for checking) fields to handle DWARF procedures generation. (struct dw_discr_list_node): New structure. * dwarf2out.c (dwarf2out_size_function): New. (dwarf2_debug_hooks): Set the size_function field to dwarf2out_size_function. (dwarf2_lineno_debug_hooks): Set the size_function field to no-op. (new_loc_descr): Initialize the dw_loc_frame_offset field. (dwarf_proc_stack_usage_map): New. (dw_val_equal_p): Handle discriminants. (size_of_discr_value): New. (size_of_discr_list): New. (size_of_die): Handle discriminants. (add_loc_descr_to_each): New. (add_loc_list): New. (print_discr_value): New. (print_dw_val): Handle discriminants. (value_format): Handle discriminants. (output_discr_value): New. (output_die): Handle discriminants. (output_loc_operands): Handle DW_OP_call2 and DW_OP_call4. (uint_loc_descriptor): New. (uint_comparison_loc_list): New. (loc_list_from_uint_comparison): New. (add_discr_value): New. (add_discr_list): New. (AT_discr_list): New. (loc_descr_to_next_no_op): New. (free_loc_descr): New. (loc_descr_without_nops): New. (struct loc_descr_context): Add a dpi field. (struct dwarf_procedure_info): New helper structure. (new_dwarf_proc_die): New. (is_handled_procedure_type): New. (resolve_args_picking_1): New. (resolve_args_picking): New. (function_to_dwarf_procedure): New. (copy_dwarf_procedure): New. (copy_dwarf_procs_ref_in_attrs): New. (copy_dwarf_procs_ref_in_dies): New. (break_out_comdat_types): Copy DWARF procedures along with the types that reference them. (loc_list_from_tree): Rename into loc_list_from_tree_1. Handle CALL_EXPR in the cases suitable for DWARF procedures. Handle for PARM_DECL when generating a location description for a DWARF procedure. Handle big unsigned INTEGER_CST nodes. Handle NON_LVALUE_EXPR, EXACT_DIV_EXPR and all unsigned comparison operators. Add a wrapper for loc_list_from_tree that strips DW_OP_nop operations from the result. (type_byte_size): New. (struct vlr_context): New helper structure. (field_byte_offset): Change signature to return either a constant offset or a location description for dynamic ones. Handle dynamic byte offsets with constant bit offsets and handle fields in variant parts. (add_data_member_location): Change signature to handle dynamic member offsets and fields in variant parts. Update call to field_byte_offset. Handle location lists. Emit a variable data member location only when -fgnat-encodings=minimal. (add_bound_info): Emit self-referential bounds only when -fgnat-encodings=minimal. (add_byte_size_attribute): Use type_byte_size in order to handle dynamic type sizes. Emit variable byte size only when -fgnat-encodings=minimal and when the target DWARF version allows them. (add_bit_offset_attribute): Change signature to handle variable-length records. Update call to field_byte_offset. (gen_descr_array_type_die): Update call to gen_field_die. Update loc_descr_context literal. (gen_type_die_for_member): Likewise. (gen_subprogram_die): Update calls to get_decl_die. (gen_field_die): Change signature to handle variable-length records. Update calls to add_bit_offset_attribute and add_data_member_location_attribute. (gen_inheritance_die): Update call to add_data_member_location_attribute. (gen_decl_die): Change signature to handle variable-length records. Update call to gen_field_die. (gen_inheritance_die): Change signature to handle variable-length records. Update call to add_data_member_location_attribute. (is_variant_part): New. (analyze_discr_in_predicate): New. (get_discr_value): New. (analyze_variants_discr): New. (gen_variant_part): New. (gen_member_die): Update calls to gen_decl_die. Call instead gen_variant_part for variant parts. (gen_type_die_with_usage): Update calls to gen_decl_die. (process_scope_var): Likewise. (force_decl_die): Likewise. (declare_in_namespace): Likewise. (dwarf2out_decl): Likewise. (prune_unused_types_walk_loc_descr): New. (prune_unused_types_walk_attribs): Mark DIEs referenced by location descriptions and loc. descr. lists. (prune_unused_types_walk): Don't mark DWARF procedures by default. Mark variant parts since nothing is supposed to reference them. (dwarf2out_init): Allocate dwarf_proc_stack_usage_map. (dwarf2out_c_finalize): Deallocate and reset dwarf_proc_stack_usage_map. gcc/testsuite/ChangeLog: * gnat.dg/specs/debug1.ads: Update the expected number of DW_AT_artificial attribute in compiler output. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@231762 138bc75d-0d04-0410-961f-82ee72b054a4
2015-12-10 * gcc-interface/gigi.h (create_var_decl): Adjust comment.Eric Botcazou
(create_subprog_decl): Likewise. * gcc-interface/utils.c (create_var_decl): Likewise. (create_subprog_decl): Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@231511 138bc75d-0d04-0410-961f-82ee72b054a4
2015-11-30 * gcc-interface/gigi.h (create_var_decl): Adjust prototype.Eric Botcazou
(create_subprog_decl): Likewise. * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Rename static_p into static_flag and add volatile_flag local variable. Do not locally change the type of a volatile object, except for the pointed-to type if the object is handled by reference. Adjust calls to create_var_decl. <E_Subprogram_Type>: Likewise for const and noreturn subprograms. (get_minimal_subprog_decl): Adjust call to create_subprog_decl. (elaborate_expression_1): Adjust call to create_var_decl. (gnat_to_gnu_field): Minor tweak. * gcc-interface/trans.c (gigi): Adjust calls to create_var_decl and create_subprog_decl. (build_raise_check): Likewise. (Subprogram_Body_to_gnu): Likewise. (create_temporary): Likewise. (Handled_Sequence_Of_Statements_to_gnu): Likewise. (Exception_Handler_to_gnu_gcc): Likewise. (Compilation_Unit_to_gnu): Likewise. (gnat_to_gnu): Likewise. * gcc-interface/utils.c (maybe_pad_type): Likewise. (create_var_decl): Add VOLATILE_FLAG parameter and handle it. (create_subprog_decl): Add CONST_FLAG and VOLATILE_FLAG parameters and handle them. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@231065 138bc75d-0d04-0410-961f-82ee72b054a4
2015-11-30 * gcc-interface/ada-tree.h (TYPE_MAX_ALIGN): New macro.Eric Botcazou
* gcc-interface/decl.c (gnat_to_gnu_entity): Do not set PACKED to -2. Remove obsolete code setting the alignment on some atomic types. When the type has no alignment but needs strict alignment and has a size clause, compute a maximum alignment and set it on the type. (adjust_packed): Remove handling of -2 argument. Deal with TYPE_ALIGN and TYPE_MAX_ALIGN directly. (gnat_to_gnu_field): Do not document -2 as argument. (components_to_record): Likewise. * gcc-interface/utils.c (finish_record_type): Do not bump alignment of the record type beyond TYPE_MAX_ALIGN. Reset the latter on exit. * gcc-interface/Makefile.in (PICFLAG_FOR_TARGET): Move around. (GNATLIBCFLAGS_FOR_C): Reformat. (GCC_CFLAGS): Delete. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@231062 138bc75d-0d04-0410-961f-82ee72b054a4
2015-11-24DWARF: materialize subprogram renamings in Ada as imported declarationsPierre-Marie de Rodat
... so that debugger users can reference them instead of the renamed subprograms. This is in accordance with the DWARF specification: the section 3.2.3 (Imported (or Renamed) Declaration Entities) allows DW_TAG_imported_declaration DIEs to be used "as a general means to rename or provide an alias for an entity regardless of the context in which the importing declaration or the imported entity occur." (wording from the DWARFv3 and DWARFv4 specifications, allowed in DWARFv2). gcc/ada/ChangeLog: * gcc-interface/utils.c (gnat_write_global_declarations): Output debugging information for top-level imported declarations. gcc/ChangeLog: * dwarf2out.c (gen_decl_die): Generate DW_TAG_imported_* instead of DW_TAG_namespace for IMPORTED_DECL declarations. Call dwarf2out_imported_module_or_decl_1 for all DWARF versions as this function already takes care of checking what it can emit. Bootstrapped, regtested and checked with GDB's testsuite on x86_64-linux. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@230821 138bc75d-0d04-0410-961f-82ee72b054a4
2015-11-18 * gcc-interface/ada-tree.h (DECL_INVARIANT_P): New macro.Eric Botcazou
* gcc-interface/gigi.h (enum standard_datatypes): Remove ADT_longjmp_decl and add ADT_not_handled_by_others_decl. (longjmp_decl): Delete. (not_handled_by_others_decl): New macro. (build_simple_component_ref): Delete. (build_component_ref): Adjust prototype. * gcc-interface/decl.c (gnat_to_gnu_entity): Adjust calls to build_component_ref. (gnat_to_gnu_field): Set DECL_INVARIANT_P on discriminants without default value. * gcc-interface/trans.c (gigi): Reorder initialization sequence and add not_handled_by_others_decl. (Attribute_to_gnu): Adjust calls to build_component_ref. (Subprogram_Body_to_gnu): Likewise. (Call_to_gnu): Likewise. (Exception_Handler_to_gnu_sjlj): Likewise. (gnat_to_gnu): Likewise. (range_check_info_d): Add inserted_cond field. (Loop_Statement_to_gnu): Make two passes on the recorded range checks. (build_noreturn_cond): New static function. (Raise_Error_to_gnu): Record range checks in loops at -O1 and above. (make_invariant): New static function. (Loop_Statement_to_gnu): Use it to compute invariant expressions for the loop bounds if possible, but do not require it if loop unswitching is enabled. * gcc-interface/utils.c (convert_to_fat_pointer): Likewise. (convert): Likewise. (maybe_unconstrained_array): Likewise. Call it instead of build_simple_component_ref and add guard for CONSTRUCTORs. (unchecked_convert): Likewise. * gcc-interface/utils2.c (compare_fat_pointers): Likewise. (build_simple_component_ref): Remove COMPONENT parameter, unify code dealing with VIEW_CONVERT_EXPR and make it more general, remove special treatment for CONSTRUCTORs of template types. (build_component_ref): Remove COMPONENT parameter and adjust call to build_simple_component_ref. (maybe_wrap_malloc): Likewise. (build_allocator): Likewise. (gnat_invariant_expr): Look through overflow checks, deal with addition and subtraction of constants and take into account DECL_INVARIANT_P for the COMPONENT_REF case. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@230575 138bc75d-0d04-0410-961f-82ee72b054a4
2015-11-122015-11-12 Pierre-Marie de Rodat <derodat@adacore.com>Arnaud Charlet
* gcc-interface/decl.c (gnat_to_gnu_entity): Create IMPORTED_DECL nodes to describe the subprogram renamings which are relevant at debug time. * gcc-interface/gigi.h (get_debug_scope): Add declaration. * gcc-interface/trans.c (Identifier_to_gnu): Consider N_Defining_Operator_Symbol as valid entities. (gnat_to_gnu): Handle N_Defining_Operator_Symbol the same way as other entities. Introduce a specific handling for N_Subprogram_Renaming_Declaration: call gnat_to_gnu_entity on the entity defined for relevant ones. (process_decls): Process subprogram renaming declarations during the second pass only. * gcc-interface/utils.c (get_debug_scope): Make it external. Consider N_Defining_Operator_Symbol as valid entities. (gnat_write_global_declarations): Output debugging information for top-level imported declarations. * gcc-interface/Makefile.in: Fix typo. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@230227 138bc75d-0d04-0410-961f-82ee72b054a4
2015-11-11adaAndrew Macleod
* gcc-interface/decl.c: Remove unused header files. * gcc-interface/misc.c: Likewise. * gcc-interface/targtyps.c: Likewise. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. c * c-array-notation.c: Remove unused header files. * c-aux-info.c: Likewise. * c-convert.c: Likewise. * c-decl.c: Likewise. * c-errors.c: Likewise. * c-lang.c: Likewise. * c-objc-common.c: Likewise. * c-parser.c: Likewise. * c-typeck.c: Likewise. * gccspec.c: Likewise. c-family * array-notation-common.c: Remove unused header files. * c-ada-spec.c: Likewise. * c-cilkplus.c: Likewise. * c-common.c: Likewise. * c-cppbuiltin.c: Likewise. * c-dump.c: Likewise. * c-format.c: Likewise. * c-gimplify.c: Likewise. * c-indentation.c: Likewise. * c-lex.c: Likewise. * c-omp.c: Likewise. * c-opts.c: Likewise. * c-pch.c: Likewise. * c-ppoutput.c: Likewise. * c-pragma.c: Likewise. * c-pretty-print.c: Likewise. * c-semantics.c: Likewise. * c-ubsan.c: Likewise. * cilk.c: Likewise. * stub-objc.c: Likewise. cp * call.c: Remove unused header files. * class.c: Likewise. * constexpr.c: Likewise. * cp-array-notation.c: Likewise. * cp-cilkplus.c: Likewise. * cp-gimplify.c: Likewise. * cp-lang.c: Likewise. * cp-objcp-common.c: Likewise. * cp-ubsan.c: Likewise. * cvt.c: Likewise. * cxx-pretty-print.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * dump.c: Likewise. * error.c: Likewise. * except.c: Likewise. * expr.c: Likewise. * friend.c: Likewise. * g++spec.c: Likewise. * init.c: Likewise. * lambda.c: Likewise. * lex.c: Likewise. * mangle.c: Likewise. * method.c: Likewise. * name-lookup.c: Likewise. * optimize.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * ptree.c: Likewise. * repo.c: Likewise. * rtti.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * tree.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. * vtable-class-hierarchy.c: Likewise. Fortran * array.c: Remove unused header files. * convert.c: Likewise. * cpp.c: Likewise. * decl.c: Likewise. * f95-lang.c: Likewise. * frontend-passes.c: Likewise. * iresolve.c: Likewise. * match.c: Likewise. * module.c: Likewise. * options.c: Likewise. * parse.c: Likewise. * target-memory.c: Likewise. * trans-array.c: Likewise. * trans-common.c: Likewise. * trans-const.c: Likewise. * trans-decl.c: Likewise. * trans-expr.c: Likewise. * trans-intrinsic.c: Likewise. * trans-io.c: Likewise. * trans-openmp.c: Likewise. * trans-stmt.c: Likewise. * trans-types.c: Likewise. * trans.c: Likewise. go * go-backend.c: Remove unused header files. * go-gcc.cc: Likewise. * go-lang.c: Likewise. * gospec.c: Likewise. Java * boehm.c: Remove unused header files. * builtins.c: Likewise. * class.c: Likewise. * constants.c: Likewise. * decl.c: Likewise. * except.c: Likewise. * expr.c: Likewise. * java-gimplify.c: Likewise. * jcf-dump.c: Likewise. * jcf-io.c: Likewise. * jcf-parse.c: Likewise. * jvgenmain.c: Likewise. * lang.c: Likewise. * mangle.c: Likewise. * mangle_name.c: Likewise. * resource.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. * verify-impl.c: Likewise. * zextract.c: Likewise. jit * dummy-frontend.c: Remove unused header files. * jit-builtins.c: Likewise. * jit-playback.c: Likewise. * jit-recording.c: Likewise. * jit-spec.c: Likewise. * libgccjit.c: Likewise. lto * lto-lang.c: Remove unused header files. * lto-object.c: Likewise. * lto-partition.c: Likewise. * lto-symtab.c: Likewise. * lto.c: Likewise. objc * objc-act.c: Remove unused header files. * objc-encoding.c: Likewise. * objc-gnu-runtime-abi-01.c: Likewise. * objc-lang.c: Likewise. * objc-map.c: Likewise. * objc-next-runtime-abi-01.c: Likewise. * objc-next-runtime-abi-02.c: Likewise. * objc-runtime-shared-support.c: Likewise. objcp * objcp-decl.c: Remove unused header files. * objcp-lang.c: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@230166 138bc75d-0d04-0410-961f-82ee72b054a4
2015-11-08Merge of the scalar-storage-order branch.Eric Botcazou
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@229965 138bc75d-0d04-0410-961f-82ee72b054a4
2015-11-07Move #undef DEF_BUILTIN* to builtins.defRichard Sandiford
I was confused at first why tree-core.h was undefining DEF_BUILTIN_CHKP before defining it, then undefining it again after including builtins.def. This is because builtins.def provides a default definition of DEF_BUILTIN_CHKP, but leaves it up to the caller to undefine it where necessary. Similarly to the previous internal-fn.def patch, it seems more obvious for builtins.def to #undef things unconditionally. One argument might have been that keeping preprocessor stuff out of the .def files makes it easier for non-cpp parsers. In practice though we already have #ifs and multiline #defines, so single-line #undefs should be easy in comparison. Tested on x86_64-linux-gnu, aarch64-linux-gnu and arm-linux-gnueabi. gcc/ada/ * gcc-interface/utils.c: Don't undef DEF_BUILTIN. gcc/c-family/ * c-common.c: Don't undef DEF_BUILTIN. gcc/jit/ * jit-builtins.c: Don't undef DEF_BUILTIN. gcc/lto/ * lto-lang.c: Don't undef DEF_BUILTIN. gcc/ * builtins.def: #undef DEF_BUILTIN and DEF_BUILTIN_CHKP * builtins.c, genmatch.c, tree-core.h: Don't undef them here. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@229924 138bc75d-0d04-0410-961f-82ee72b054a4