aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/trans.c
AgeCommit message (Collapse)AuthorFilesLines
2020-12-07Fix internal error on library-level type extended locallyEric Botcazou1-2/+5
The compiler aborts on the local extension of a tagged type declared at library level, with a progenitor given by an interface type having a primitive that is a homograph of a primitive of the tagged type. gcc/ada/ChangeLog: * gcc-interface/trans.c (maybe_make_gnu_thunk): Return false if the target is local and thunk and target do not have the same context.
2020-12-07Fix assembler name collisionEric Botcazou1-0/+4
Gigi uses a dummy global variable to register global types for debug info purposes and its name can now collide with user variables. gcc/ada/ChangeLog: * gcc-interface/trans.c (lvalue_for_aggregate_p): Also return true for return statements. * gcc-interface/utils.c (gnat_write_global_declarations): Use the maximum index for the dummy object to avoid a name collision.
2020-12-07Fix corner case issue with discriminated record typeEric Botcazou1-4/+14
The compiler generates code that writes too much data into a component of a record subject to a representation clause, when the source of the assignment is a call to a function that returns a discriminated record type with default discriminants, variable size and a statically known upper bound for this size, and the size of the component given by the representation clause is lower than the value of this bound rounded up to the alignment. gcc/ada/ChangeLog: * gcc-interface/trans.c (Call_to_gnu): Also create a temporary for the return value if the LHS is a bit-field and the return type is a type padding a self-referential type. (gnat_to_gnu): Do not remove the padding on the result if it is too small with regard to the natural padding size.
2020-11-30[Ada] Remove all ^L charactersArnaud Charlet1-1/+1
gcc/ada/ * gcc-interface/Makefile.in, gcc-interface/trans.c: Remove ^L characters.
2020-11-11Remove superfluous call to Base_TypeEric Botcazou1-36/+34
gcc/ada/ChangeLog: * gcc-interface/gigi.h: Remove ^L characters throughout. * gcc-interface/decl.c: Likewise. * gcc-interface/utils.c: Likewise. * gcc-interface/utils2.c: Likewise. * gcc-interface/trans.c (gnat_to_gnu) <N_Allocator>: Do not explicitly go to the base type for the Has_Constrained_Partial_View flag.
2020-11-11Fix biased integer arithmeticEric Botcazou1-0/+5
The Ada compiler uses a biased representation when a size clause reserves fewer bits than normal either for the lower or for the upper bound. gcc/ada/ChangeLog: * gcc-interface/trans.c (build_binary_op_trapv): Convert operands to the result type before doing generic overflow checking. gcc/testsuite/ChangeLog: * gnat.dg/bias2.adb: New test.
2020-11-11Fix segfault on elaboration of empty 1-element array at -OEric Botcazou1-42/+7
This is a rather obscure case where the elaboration of an empty array whose base type is an array type of length at most 1 goes awry when the code is compiled with optimization. gcc/ada/ChangeLog: * gcc-interface/trans.c (can_be_lower_p): Remove. (Regular_Loop_to_gnu): Add ENTRY_COND unconditionally if BOTTOM_COND is non-zero. gcc/testsuite/ChangeLog: * gnat.dg/opt89.adb: New test.
2020-11-11Fix internal error with Shift_Right operator on signed typeEric Botcazou1-0/+2
This is a regression present on the mainline and 10 branch in the form of an ICE with a shift operator applied to a variable of a signed type, and which is caused by a type mismatch. gcc/ada/ChangeLog: * gcc-interface/trans.c (gnat_to_gnu) <N_Op_Shift>: Also convert GNU_MAX_SHIFT if the type of the operation has been changed. * gcc-interface/utils.c (can_materialize_object_renaming_p): Add pair of missing parentheses. gcc/testsuite/ChangeLog: * gnat.dg/shift1.adb: New test.
2020-10-23[Ada] Implement new legality rules introduced in C.6(12) by AI12-0363Eric Botcazou1-2/+2
gcc/ada/ * doc/gnat_rm/implementation_defined_pragmas.rst (VFA): Remove uage restrictions in conjunction with Atomic and Aliased. * gnat_rm.texi: Regenerate. * aspects.ads (Aspect_Id): Add Aspect_Full_Access_Only. (Is_Representation_Aspect): Likewise. (Aspect_Names): Likewise. (Aspect_Delay): Likewise. * einfo.ads (Is_Atomic_Or_VFA): Rename into... (Is_Full_Access): ...this. (Is_Volatile_Full_Access): Document new usage for Full_Access_Only. * einfo.adb (Is_Atomic_Or_VFA): Rename into... (Is_Full_Access): ...this. * freeze.ads (Is_Atomic_VFA_Aggregate): Rename into... (Is_Full_Access_Aggregate): ...this. * freeze.adb (Is_Atomic_VFA_Aggregate): Rename into... (Is_Full_Access_Aggregate): ...this. Adjust to above renaming. (Freeze_Array_Type): Likewise. (Freeze_Entity): Likewise. * exp_aggr.adb (Aggr_Assignment_OK_For_Backend): Likewise. (Expand_Record_Aggregate): Likewise. * exp_ch4.adb (Expand_N_Op_Eq): Likewise. * exp_ch5.adb (Expand_Assign_Array): Likewise. * exp_ch8.adb (Evaluation_Required): Likewise. * layout.adb (Layout_Type): Likewise. (Set_Composite_Alignment): Likewise. * sem_aux.ads (Has_Rep_Item): Delete. * sem_aux.adb (Has_Rep_Item): Likewise. * sem_attr.adb (Resolve_Attribute) <Attribute_Access>: Implement new legality rules in C.6(12). * sem_ch12.adb (Instantiate_Object): Likewise. * sem_res.adb (Resolve_Actuals): Likewise. * sem_ch13.adb (Inherit_Delayed_Rep_Aspects): Deal with aspect Full_Access_Only. (Check_False_Aspect_For_Derived_Type): Likewise. (Make_Pragma_From_Boolean_Aspect): Test for the presence of Expr. Deal with aspect Full_Access_Only. (Analyze_Aspects_At_Freeze_Point): Likewise. (Analyze_One_Aspect): Do not set Delay_Required to true even for Always_Delay boolean aspects if they have no expression. Force Delay_Required to true for aspect Full_Access_Only in all cases. Reject aspect Full_Access_Only if not in Ada 2020 mode. (Check_Aspect_At_End_Of_Declarations): Deal with empty expression. (Check_Aspect_At_Freeze_Point): Likewise. (Rep_Item_Entity): Delete. (Inherit_Aspects_At_Freeze_Point): Align handling for Bit_Order with that for Scalar_Storage_Order. * sem_prag.adb (Check_Atomic_VFA): Delete. (Check_VFA_Conflicts): Likewise. (Check_Full_Access_Only): New procedure. (Process_Atomic_Independent_Shared_Volatile): Call to implement the new legality checks in C.6(8/2) and mark the entity last. (Analyze_Pragma) <Pragma_Atomic_Components>: Remove obsolete check. * sem_util.ads (Is_Atomic_Or_VFA_Object): Rename into... (Is_Full_Access_Object): ...this. (Is_Subcomponent_Of_Atomic_Object): Rename into... (Is_Subcomponent_Of_Full_Access_Object): ...this. * sem_util.adb (Inherit_Rep_Item_Chain): Use Present_In_Rep_Item. (Is_Atomic_Or_VFA_Object): Rename into... (Is_Full_Access_Object): ...this. (Is_Subcomponent_Of_Atomic_Object): Rename into... (Is_Subcomponent_Of_Full_Access_Object): ...this and adjust. * snames.ads-tmpl (Name_Full_Access_Only): New name of aspect. * gcc-interface/decl.c (gnat_to_gnu_entity): Adjust for renaming. (promote_object_alignment): Likewise. (gnat_to_gnu_field): Likewise. Rename local variable and use specific qualifier in error message for Volatile_Full_Access. * gcc-interface/trans.c (lvalue_required_p): Likewise.
2020-10-22Move nested function info out of cgraph_nodeJan Hubicka1-1/+3
this patch moves nested function information out of symbol table (to a summary). This saves memory (especially at WPA time) and also makes nested function support more contained. gcc/ChangeLog: 2020-10-22 Jan Hubicka <hubicka@ucw.cz> * cgraph.c: Include tree-nested.h (cgraph_node::create): Call maybe_record_nested_function. (cgraph_node::remove): Do not remove function from nested function infos. (cgraph_node::dump): Update. (cgraph_node::unnest): Move to tree-nested.c (cgraph_node::verify_node): Update. (cgraph_c_finalize): Call nested_function_info::release. * cgraph.h (struct symtab_node): Remove nested function info. * cgraphclones.c (cgraph_node::create_clone): Do not clone nested function info. * cgraphunit.c (cgraph_node::analyze): Update. (cgraph_node::expand): Do not worry about nested functions; they are lowered. (symbol_table::finalize_compilation_unit): Call nested_function_info::release. * gimplify.c: Include tree-nested.h (unshare_body): Update. (unvisit_body): Update. * omp-offload.c (omp_discover_implicit_declare_target): Update. * tree-nested.c: Include alloc-pool.h, tree-nested.h, symbol-summary.h (nested_function_sum): New static variable. (nested_function_info::get): New member function. (nested_function_info::get_create): New member function. (unnest_function): New function. (nested_function_info::~nested_function_info): New member function. (nested_function_info::release): New function. (maybe_record_nested_function): New function. (lookup_element_for_decl): Update. (check_for_nested_with_variably_modified): Update. (create_nesting_tree): Update. (unnest_nesting_tree_1): Update. (gimplify_all_functions): Update. (lower_nested_functions): Update. * tree-nested.h (class nested_function_info): New class. (maybe_record_nested_function): Declare. (unnest_function): Declare. (first_nested_function): New inline function. (next_nested_function): New inline function. (nested_function_origin): New inline function. gcc/ada/ChangeLog: 2020-10-22 Jan Hubicka <hubicka@ucw.cz> * gcc-interface/trans.c: Include tree-nested.h (walk_nesting_tree): Update for new nested function info. gcc/c-family/ChangeLog: 2020-10-22 Jan Hubicka <hubicka@ucw.cz> * c-gimplify.c: Include tree-nested.h (c_genericize): Update for new nested function info. gcc/d/ChangeLog: 2020-10-22 Jan Hubicka <hubicka@ucw.cz> * decl.cc: Include tree-nested.h (get_symbol_decl): Update for new nested function info.
2020-09-28Add missing end location informationEric Botcazou1-6/+5
In some cases we would fail to put the end location information on the outermost BIND_EXPR of a function, which is problematic when there is a dynamic stack allocation. gcc/ada/ChangeLog: * gcc-interface/trans.c (Subprogram_Body_to_gnu): Set the end locus of body and declaration earlier.
2020-09-14options: Save and restore opts_set for Optimization and Target optionsJakub Jelinek1-1/+2
> Seems a latent issue. > Neither cl_optimization_{save,restore} nor cl_target_option_{save,restore} > (nor any of the target hooks they call) saves or restores any opts_set > values, so I think opts_set can be trusted only during option processing (if > at all), but not later. > So, short term a fix would be IMHO just stop using opts_set altogether in > arm_configure_build_target, it doesn't make much sense to me, it should test > if those strings are non-NULL instead, or at least do that when it is > invoked from arm_option_restore (e.g. could be done by calling it with > opts instead of &global_options_set ). > Longer term, the question is if cl_optimization_{save,restore} and > cl_target_option_{save,restore} shouldn't be changed not to only > save/restore the options, but also save the opts_set flags. > It could be done e.g. by adding a bool array or set of bool members > to struct cl_optimization and struct cl_target_option , or even more compact > by using bitmasks, pack each 64 adjacent option flags into a UHWI element > of an array. So, I've tried under debugger how it behaves and seems global_options_set is really an or of whether an option has been ever seen as explicit, either on the command line or in any of the option pragmas or optimize/target attributes seen so far, so it isn't something that can be relied on. The following patch implements the saving/restoring of the opts_set bits (though only for the options/variables saved by the generic options-save.c code, for the target specific stuff that isn't handled by the generic code the opts_set argument is now passed to the hook and the backends can choose e.g. to use a TargetSave variable to save the flags either individually or together in some bitmask (or ignore it if they never need opts_set for the options). This patch itself doesn't fix the testcase failing on arm, but a follow up patch will. 2020-09-14 Jakub Jelinek <jakub@redhat.com> gcc/ * opt-read.awk: Also initialize extra_target_var_types array. * opth-gen.awk: Emit explicit_mask arrays to struct cl_optimization and cl_target_option. Adjust cl_optimization_save, cl_optimization_restore, cl_target_option_save and cl_target_option_restore declarations. * optc-save-gen.awk: Add opts_set argument to cl_optimization_save, cl_optimization_restore, cl_target_option_save and cl_target_option_restore functions and save or restore opts_set next to the opts values into or from explicit_mask arrays. In cl_target_option_eq and cl_optimization_option_eq compare explicit_mask arrays, in cl_target_option_hash and cl_optimization_hash hash them and in cl_target_option_stream_out, cl_target_option_stream_in, cl_optimization_stream_out and cl_optimization_stream_in stream them. * tree.h (build_optimization_node, build_target_option_node): Add opts_set argument. * tree.c (build_optimization_node): Add opts_set argument, pass it to cl_optimization_save. (build_target_option_node): Add opts_set argument, pass it to cl_target_option_save. * function.c (invoke_set_current_function_hook): Adjust cl_optimization_restore caller. * ipa-inline-transform.c (inline_call): Adjust cl_optimization_restore and build_optimization_node callers. * target.def (TARGET_OPTION_SAVE, TARGET_OPTION_RESTORE): Add opts_set argument. * target-globals.c (save_target_globals_default_opts): Adjust cl_optimization_restore callers. * toplev.c (process_options): Adjust build_optimization_node and cl_optimization_restore callers. (target_reinit): Adjust cl_optimization_restore caller. * tree-streamer-in.c (lto_input_ts_function_decl_tree_pointers): Adjust build_optimization_node and cl_optimization_restore callers. * doc/tm.texi: Updated. * config/aarch64/aarch64.c (aarch64_override_options): Adjust build_target_option_node caller. (aarch64_option_save, aarch64_option_restore): Add opts_set argument. (aarch64_set_current_function): Adjust cl_target_option_restore caller. (aarch64_option_valid_attribute_p): Adjust cl_target_option_save, cl_target_option_restore, cl_optimization_restore, build_optimization_node and build_target_option_node callers. * config/aarch64/aarch64-c.c (aarch64_pragma_target_parse): Adjust cl_target_option_restore and build_target_option_node callers. * config/arm/arm.c (arm_option_save, arm_option_restore): Add opts_set argument. (arm_option_override): Adjust cl_target_option_save, build_optimization_node and build_target_option_node callers. (arm_set_current_function): Adjust cl_target_option_restore caller. (arm_valid_target_attribute_tree): Adjust build_target_option_node caller. (add_attribute): Formatting fix. (arm_valid_target_attribute_p): Adjust cl_optimization_restore, cl_target_option_restore, arm_valid_target_attribute_tree and build_optimization_node callers. * config/arm/arm-c.c (arm_pragma_target_parse): Adjust cl_target_option_restore callers. * config/csky/csky.c (csky_option_override): Adjust build_target_option_node and cl_target_option_save callers. * config/gcn/gcn.c (gcn_fixup_accel_lto_options): Adjust build_optimization_node and cl_optimization_restore callers. * config/i386/i386-builtins.c (get_builtin_code_for_version): Adjust cl_target_option_save and cl_target_option_restore callers. * config/i386/i386-c.c (ix86_pragma_target_parse): Adjust build_target_option_node and cl_target_option_restore callers. * config/i386/i386-options.c (ix86_function_specific_save, ix86_function_specific_restore): Add opts_set arguments. (ix86_valid_target_attribute_tree): Adjust build_target_option_node caller. (ix86_valid_target_attribute_p): Adjust build_optimization_node, cl_optimization_restore, cl_target_option_restore, ix86_valid_target_attribute_tree and build_optimization_node callers. (ix86_option_override_internal): Adjust build_target_option_node caller. (ix86_reset_previous_fndecl, ix86_set_current_function): Adjust cl_target_option_restore callers. * config/i386/i386-options.h (ix86_function_specific_save, ix86_function_specific_restore): Add opts_set argument. * config/nios2/nios2.c (nios2_option_override): Adjust build_target_option_node caller. (nios2_option_save, nios2_option_restore): Add opts_set argument. (nios2_valid_target_attribute_tree): Adjust build_target_option_node caller. (nios2_valid_target_attribute_p): Adjust build_optimization_node, cl_optimization_restore, cl_target_option_save and cl_target_option_restore callers. (nios2_set_current_function, nios2_pragma_target_parse): Adjust cl_target_option_restore callers. * config/pru/pru.c (pru_option_override): Adjust build_target_option_node caller. (pru_set_current_function): Adjust cl_target_option_restore callers. * config/rs6000/rs6000.c (rs6000_debug_reg_global): Adjust cl_target_option_save caller. (rs6000_option_override_internal): Adjust build_target_option_node caller. (rs6000_valid_attribute_p): Adjust build_optimization_node, cl_optimization_restore, cl_target_option_save, cl_target_option_restore and build_target_option_node callers. (rs6000_pragma_target_parse): Adjust cl_target_option_restore and build_target_option_node callers. (rs6000_activate_target_options): Adjust cl_target_option_restore callers. (rs6000_function_specific_save, rs6000_function_specific_restore): Add opts_set argument. * config/s390/s390.c (s390_function_specific_restore): Likewise. (s390_option_override_internal): Adjust s390_function_specific_restore caller. (s390_option_override, s390_valid_target_attribute_tree): Adjust build_target_option_node caller. (s390_valid_target_attribute_p): Adjust build_optimization_node, cl_optimization_restore and cl_target_option_restore callers. (s390_activate_target_options): Adjust cl_target_option_restore caller. * config/s390/s390-c.c (s390_cpu_cpp_builtins): Adjust cl_target_option_save caller. (s390_pragma_target_parse): Adjust build_target_option_node and cl_target_option_restore callers. gcc/c-family/ * c-attribs.c (handle_optimize_attribute): Adjust cl_optimization_save, cl_optimization_restore and build_optimization_node callers. * c-pragma.c (handle_pragma_optimize): Adjust build_optimization_node caller. (handle_pragma_push_options): Adjust build_optimization_node and build_target_option_node callers. (handle_pragma_pop_options, handle_pragma_reset_options): Adjust cl_optimization_restore callers. gcc/go/ * go-gcc.cc (Gcc_backend::function): Adjust cl_optimization_save, cl_optimization_restore and build_optimization_node callers. gcc/ada/ * gcc-interface/trans.c (gigi): Adjust build_optimization_node caller.
2020-09-12Add preliminary support for 128-bit integer typesEric Botcazou1-0/+22
This is only the gigi part, in preparation for the bulk of the implementation. gcc/ada/ChangeLog: * fe.h: Fix pilot error in previous change. * gcc-interface/gigi.h (enum standard_datatypes): Add ADT_mulv128_decl. (mulv128_decl): New macro. (get_target_long_long_long_size): Declare. * gcc-interface/decl.c (gnat_to_gnu_entity): Use a maximum size of 128 bits for discrete types if Enable_128bit_Types is true. * gcc-interface/targtyps.c: Include target.h. (get_target_long_long_long_size): New function. * gcc-interface/trans.c (gigi): Initialize mulv128_decl if need be. (build_binary_op_trapv): Call it for 128-bit multiplication. * gcc-interface/utils.c (make_type_from_size): Enforce a maximum size of 128 bits if Enable_128bit_Types is true.
2020-09-12Fix small inconsistency in new predicateEric Botcazou1-6/+2
This can result on the mainline in a segfault when an object declared at library level is used in the declaration of another, local object. gcc/ada/ChangeLog: * gcc-interface/trans.c (lvalue_for_aggr_p) <N_Object_Declaration>: Return false unconditionally.
2020-09-12Minor tweak to line debug infoEric Botcazou1-0/+6
This prevents the SLOC of the expression for a tag from being present in the line debug info every time it is referenced for coverage purposes. gcc/ada/ChangeLog: * gcc-interface/trans.c (gnat_to_gnu) <N_Object_Declaration>: Clear the SLOC of the expression of a tag.
2020-08-27vec: add exact argument for various grow functions.Martin Liska1-2/+2
gcc/ada/ChangeLog: * gcc-interface/trans.c (gigi): Set exact argument of a vector growth function to true. (Attribute_to_gnu): Likewise. gcc/ChangeLog: * alias.c (init_alias_analysis): Set exact argument of a vector growth function to true. * calls.c (internal_arg_pointer_based_exp_scan): Likewise. * cfgbuild.c (find_many_sub_basic_blocks): Likewise. * cfgexpand.c (expand_asm_stmt): Likewise. * cfgrtl.c (rtl_create_basic_block): Likewise. * combine.c (combine_split_insns): Likewise. (combine_instructions): Likewise. * config/aarch64/aarch64-sve-builtins.cc (function_expander::add_output_operand): Likewise. (function_expander::add_input_operand): Likewise. (function_expander::add_integer_operand): Likewise. (function_expander::add_address_operand): Likewise. (function_expander::add_fixed_operand): Likewise. * df-core.c (df_worklist_dataflow_doublequeue): Likewise. * dwarf2cfi.c (update_row_reg_save): Likewise. * early-remat.c (early_remat::init_block_info): Likewise. (early_remat::finalize_candidate_indices): Likewise. * except.c (sjlj_build_landing_pads): Likewise. * final.c (compute_alignments): Likewise. (grow_label_align): Likewise. * function.c (temp_slots_at_level): Likewise. * fwprop.c (build_single_def_use_links): Likewise. (update_uses): Likewise. * gcc.c (insert_wrapper): Likewise. * genautomata.c (create_state_ainsn_table): Likewise. (add_vect): Likewise. (output_dead_lock_vect): Likewise. * genmatch.c (capture_info::capture_info): Likewise. (parser::finish_match_operand): Likewise. * genrecog.c (optimize_subroutine_group): Likewise. (merge_pattern_info::merge_pattern_info): Likewise. (merge_into_decision): Likewise. (print_subroutine_start): Likewise. (main): Likewise. * gimple-loop-versioning.cc (loop_versioning::loop_versioning): Likewise. * gimple.c (gimple_set_bb): Likewise. * graphite-isl-ast-to-gimple.c (translate_isl_ast_node_user): Likewise. * haifa-sched.c (sched_extend_luids): Likewise. (extend_h_i_d): Likewise. * insn-addr.h (insn_addresses_new): Likewise. * ipa-cp.c (gather_context_independent_values): Likewise. (find_more_contexts_for_caller_subset): Likewise. * ipa-devirt.c (final_warning_record::grow_type_warnings): Likewise. (ipa_odr_read_section): Likewise. * ipa-fnsummary.c (evaluate_properties_for_edge): Likewise. (ipa_fn_summary_t::duplicate): Likewise. (analyze_function_body): Likewise. (ipa_merge_fn_summary_after_inlining): Likewise. (read_ipa_call_summary): Likewise. * ipa-icf.c (sem_function::bb_dict_test): Likewise. * ipa-prop.c (ipa_alloc_node_params): Likewise. (parm_bb_aa_status_for_bb): Likewise. (ipa_compute_jump_functions_for_edge): Likewise. (ipa_analyze_node): Likewise. (update_jump_functions_after_inlining): Likewise. (ipa_read_edge_info): Likewise. (read_ipcp_transformation_info): Likewise. (ipcp_transform_function): Likewise. * ipa-reference.c (ipa_reference_write_optimization_summary): Likewise. * ipa-split.c (execute_split_functions): Likewise. * ira.c (find_moveable_pseudos): Likewise. * lower-subreg.c (decompose_multiword_subregs): Likewise. * lto-streamer-in.c (input_eh_regions): Likewise. (input_cfg): Likewise. (input_struct_function_base): Likewise. (input_function): Likewise. * modulo-sched.c (set_node_sched_params): Likewise. (extend_node_sched_params): Likewise. (schedule_reg_moves): Likewise. * omp-general.c (omp_construct_simd_compare): Likewise. * passes.c (pass_manager::create_pass_tab): Likewise. (enable_disable_pass): Likewise. * predict.c (determine_unlikely_bbs): Likewise. * profile.c (compute_branch_probabilities): Likewise. * read-rtl-function.c (function_reader::parse_block): Likewise. * read-rtl.c (rtx_reader::read_rtx_code): Likewise. * reg-stack.c (stack_regs_mentioned): Likewise. * regrename.c (regrename_init): Likewise. * rtlanal.c (T>::add_single_to_queue): Likewise. * sched-deps.c (init_deps_data_vector): Likewise. * sel-sched-ir.c (sel_extend_global_bb_info): Likewise. (extend_region_bb_info): Likewise. (extend_insn_data): Likewise. * symtab.c (symtab_node::create_reference): Likewise. * tracer.c (tail_duplicate): Likewise. * trans-mem.c (tm_region_init): Likewise. (get_bb_regions_instrumented): Likewise. * tree-cfg.c (init_empty_tree_cfg_for_function): Likewise. (build_gimple_cfg): Likewise. (create_bb): Likewise. (move_block_to_fn): Likewise. * tree-complex.c (tree_lower_complex): Likewise. * tree-if-conv.c (predicate_rhs_code): Likewise. * tree-inline.c (copy_bb): Likewise. * tree-into-ssa.c (get_ssa_name_ann): Likewise. (mark_phi_for_rewrite): Likewise. * tree-object-size.c (compute_builtin_object_size): Likewise. (init_object_sizes): Likewise. * tree-predcom.c (initialize_root_vars_store_elim_1): Likewise. (initialize_root_vars_store_elim_2): Likewise. (prepare_initializers_chain_store_elim): Likewise. * tree-ssa-address.c (addr_for_mem_ref): Likewise. (multiplier_allowed_in_address_p): Likewise. * tree-ssa-coalesce.c (ssa_conflicts_new): Likewise. * tree-ssa-forwprop.c (simplify_vector_constructor): Likewise. * tree-ssa-loop-ivopts.c (addr_offset_valid_p): Likewise. (get_address_cost_ainc): Likewise. * tree-ssa-loop-niter.c (discover_iteration_bound_by_body_walk): Likewise. * tree-ssa-pre.c (add_to_value): Likewise. (phi_translate_1): Likewise. (do_pre_regular_insertion): Likewise. (do_pre_partial_partial_insertion): Likewise. (init_pre): Likewise. * tree-ssa-propagate.c (ssa_prop_init): Likewise. (update_call_from_tree): Likewise. * tree-ssa-reassoc.c (optimize_range_tests_cmp_bitwise): Likewise. * tree-ssa-sccvn.c (vn_reference_lookup_3): Likewise. (vn_reference_lookup_pieces): Likewise. (eliminate_dom_walker::eliminate_push_avail): Likewise. * tree-ssa-strlen.c (set_strinfo): Likewise. (get_stridx_plus_constant): Likewise. (zero_length_string): Likewise. (find_equal_ptrs): Likewise. (printf_strlen_execute): Likewise. * tree-ssa-threadedge.c (set_ssa_name_value): Likewise. * tree-ssanames.c (make_ssa_name_fn): Likewise. * tree-streamer-in.c (streamer_read_tree_bitfields): Likewise. * tree-vect-loop.c (vect_record_loop_mask): Likewise. (vect_get_loop_mask): Likewise. (vect_record_loop_len): Likewise. (vect_get_loop_len): Likewise. * tree-vect-patterns.c (vect_recog_mask_conversion_pattern): Likewise. * tree-vect-slp.c (vect_slp_convert_to_external): Likewise. (vect_bb_slp_scalar_cost): Likewise. (vect_bb_vectorization_profitable_p): Likewise. (vectorizable_slp_permutation): Likewise. * tree-vect-stmts.c (vectorizable_call): Likewise. (vectorizable_simd_clone_call): Likewise. (scan_store_can_perm_p): Likewise. (vectorizable_store): Likewise. * expr.c: Likewise. * vec.c (test_safe_grow_cleared): Likewise. * vec.h (vec_safe_grow): Likewise. (vec_safe_grow_cleared): Likewise. (vl_ptr>::safe_grow): Likewise. (vl_ptr>::safe_grow_cleared): Likewise. * config/c6x/c6x.c (insn_set_clock): Likewise. gcc/c/ChangeLog: * gimple-parser.c (c_parser_gimple_compound_statement): Set exact argument of a vector growth function to true. gcc/cp/ChangeLog: * class.c (build_vtbl_initializer): Set exact argument of a vector growth function to true. * constraint.cc (get_mapped_args): Likewise. * decl.c (cp_maybe_mangle_decomp): Likewise. (cp_finish_decomp): Likewise. * parser.c (cp_parser_omp_for_loop): Likewise. * pt.c (canonical_type_parameter): Likewise. * rtti.c (get_pseudo_ti_init): Likewise. gcc/fortran/ChangeLog: * trans-openmp.c (gfc_trans_omp_do): Set exact argument of a vector growth function to true. gcc/lto/ChangeLog: * lto-common.c (lto_file_finalize): Set exact argument of a vector growth function to true.
2020-06-23Fix memory corruption with vector and variant recordEric Botcazou1-6/+12
The problem is that Has_Constrained_Partial_View must be tested on the base type of the designated type of an allocator. gcc/ada/ChangeLog: * gcc-interface/trans.c (gnat_to_gnu) <N_Allocator>: Minor tweaks. Call Has_Constrained_Partial_View on base type of designated type.
2020-06-23Streamline implementation of renaming in gigiEric Botcazou1-35/+14
The main changes are 1) the bulk of the implementation is put back entirely in gnat_to_gnu_entity and 2) the handling of lvalues is unified, i.e. it no longer depends on the Materialize_Entity flag being present on the entity. gcc/ada/ChangeLog: * gcc-interface/ada-tree.h (DECL_RENAMED_OBJECT): Delete. * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Always use the stabilized reference directly for renaming and create a variable pointing to it separately if requested. * gcc-interface/misc.c (gnat_print_decl): Adjust for deletion. * gcc-interface/trans.c (Identifier_to_gnu): Likewise. (gnat_to_gnu) <N_Object_Renaming_Declaration>: Do not deal with side-effects here. <N_Exception_Renaming_Declaration>: Likewise.
2020-06-23Minor adjustment in assignment caseEric Botcazou1-4/+3
gcc/ada/ChangeLog: * gcc-interface/trans.c (gnat_to_gnu) <N_Assignment_Statement>: Do not test Is_Bit_Packed_Array in the memset path.
2020-06-19[Ada] Remove handling of 'Pos and 'Val attributes from gigiEric Botcazou1-13/+0
2020-06-19 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * gcc-interface/trans.c (lvalue_required_for_attribute_p): Do not deal with 'Pos or 'Val. (Attribute_to_gnu): Likewise. * gcc-interface/utils.c (create_field_decl): Small formatting fix.
2020-06-19[Ada] Consolidate handling of implicit dereferencesEric Botcazou1-55/+25
2020-06-19 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * gcc-interface/trans.c (adjust_for_implicit_deref): Delete. (maybe_implicit_deref): Likewise. (Attribute_to_gnu): Replace calls to maybe_implicit_deref by calls to maybe_padded_object. (Call_to_gnu): Likewise. (gnat_to_gnu) <N_Indexed_Component>: Likewise. <N_Slice>: Likewise. <N_Selected_Component>: Likewise. <N_Free_Statement>: Remove call to adjust_for_implicit_deref and manually make sure that the designated type is complete. * gcc-interface/utils2.c (build_simple_component_ref): Add comment.
2020-06-19[Ada] AI12-0028-1 Import of variadic C functionsEric Botcazou1-26/+116
2020-06-19 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * gcc-interface/decl.c (gnat_to_gnu_param): Tidy up. (gnat_to_gnu_subprog_type): For a variadic C function, do not build unnamed parameters and do not add final void node. * gcc-interface/misc.c: Include snames.h. * gcc-interface/trans.c (Attribute_to_gnu): Tidy up. (Call_to_gnu): Implement support for unnamed parameters in a variadic C function. * gcc-interface/utils.c: Include snames.h. (copy_type): Tidy up.
2020-06-04[Ada] Remove OpenACC supportArnaud Charlet1-671/+1
2020-06-04 Arnaud Charlet <charlet@adacore.com> gcc/ada/ * back_end.adb, opt.ads, par-prag.adb, sem_ch5.adb, sem_prag.adb, sinfo.adb, sinfo.ads, snames.ads-tmpl, doc/gnat_rm/implementation_defined_pragmas.rst: Remove experimental support for OpenACC. * gcc-interface/misc.c, gcc-interface/trans.c, gcc-interface/lang.opt: Ditto. * gnat_rm.texi: Regenerate. gcc/testsuite/ * gnat.dg/openacc1.adb: Remove testcase.
2020-05-25Fix wrong assignment to mutable Out parameter of task entryEric Botcazou1-4/+7
Under very specific circumstances the compiler can generate a wrong assignment to a mutable record object which contains an array component, because it does not correctly handle the update of the discriminant. gcc/ada/ChangeLog * gcc-interface/gigi.h (operand_type): New static inline function. * gcc-interface/trans.c (gnat_to_gnu): Do not suppress conversion to the resulty type at the end for array types. * gcc-interface/utils2.c (build_binary_op) <MODIFY_EXPR>: Do not remove conversions between array types on the LHS. gcc/testsuite/ChangeLog * gnat.dg/array39.adb: New test. * gnat.dg/array39_pkg.ads: New helper. * gnat.dg/array39_pkg.adb: Likewise.
2020-05-12Be prepared for more aggregates in gigiEric Botcazou1-2/+2
This makes sure that gigi is prepared to handle more aggregates in the special memset code path. * sem_aggr.ads (Is_Single_Aggregate): New function. * sem_aggr.adb (Is_Others_Aggregate): Use local variable. (Is_Single_Aggregate): New function to recognize an aggregate with a single association containing a single choice. * fe.h (Is_Others_Aggregate): Delete. (Is_Single_Aggregate): New declaration. * gcc-interface/trans.c (gnat_to_gnu) <N_Assignment_Statement>: Call Is_Single_Aggregate instead of Is_Others_Aggregate.
2020-05-09Update copyright yearEric Botcazou1-1/+1
2020-05-09Add assertion for access attributesEric Botcazou1-0/+3
* gcc-interface/trans.c (Attribute_to_gnu) <Attr_Access>: Assert that the prefix is not a type.
2020-05-09Do not make a local copy of large aggregateEric Botcazou1-13/+73
This prevents gigi from making a local copy of large aggregates. * gcc-interface/trans.c (lvalue_required_p) <N_Selected_Component>: Merge with N_Slice. <N_Allocator>: Move to... (lvalue_for_aggregate_p): ...here. New function. (Identifier_to_gnu): For an identifier with aggregate type, also call lvalue_for_aggregate_p if lvalue_required_p returned false before substituting the identifier with the constant.
2020-05-09Fix problematic cases of wrappingEric Botcazou1-2/+3
* gcc-interface/trans.c (gnat_to_gnu): Do not wrap boolean values if they appear in any kind of attribute references.
2020-05-09Accept qualified aggregates in memset pathEric Botcazou1-12/+16
Aggregates can be surrounded by a qualified expression and this prepares the support code in gigi for accepting them. * gcc-interface/trans.c (gnat_to_gnu) <N_Assignment_Statement>: Deal with qualified "others" aggregates in the memset case.
2020-05-09Small housekeeping work in gigiEric Botcazou1-54/+12
No functional changes. * gcc-interface/gigi.h (change_qualified_type): Move around. (maybe_vector_array): Likewise. (maybe_padded_object): New static line function. * gcc-interface/trans.c (Attribute_to_gnu) <Attr_Component_Size>: Remove useless code. <Attr_Null_Parameter>: Remove obsolete code. (Call_to_gn): Likewise. Use maybe_padded_object to remove padding. (gnat_to_gnu): Likewise. <N_String_Literal>: Do not add a useless null character at the end. <N_Indexed_Component>: Likewise and remove obsolete code. (add_decl_expr): Likewise. (maybe_implicit_deref): Likewise. * gcc-interface/utils.c (maybe_unconstrained_array): Likewise. * gcc-interface/utils2.c (gnat_invariant_expr): Likewise.
2020-05-08Fix missing information in exception messages with -gnateEEric Botcazou1-25/+27
The information was missing in cases the front-end was able to turn the range comparison into a simple comparison. * gcc-interface/trans.c (Raise_Error_to_gnu): Always compute a lower bound and an upper bound for use by the -gnateE switch for range and comparison operators.
2019-12-18trans.c (Pragma_to_gnu): Push a diagnostics state for pragma Warnings (Off) ↵Eric Botcazou1-1/+15
before turning off all the... * gcc-interface/trans.c (Pragma_to_gnu) <Pragma_Warnings>: Push a diagnostics state for pragma Warnings (Off) before turning off all the warnings and only pop it for pragma Warnings (On). From-SVN: r279519
2019-12-16[Ada] Fully propagate representation aspects through renamingEric Botcazou1-2/+2
2019-12-16 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * sem_ch8.adb (Analyze_Object_Renaming): Set Atomic, Independent and Volatile_Full_Access aspects on the entity of the renaming the same way as the Volatile aspect is set. * sem_util.ads (Is_Atomic_Object_Entity): Move declaration to... (Is_Independent_Object): New function. (Is_Volatile_Full_Access_Object): Likewise. * sem_util.adb (Is_Atomic_Object_Entity): ...here. (Prefix_Has_Atomic_Components): Minor tweak. (Is_Atomic_Object): Test Is_Atomic on the Etype uniformly. (Is_Atomic_Or_VFA_Object): Call Is_Volatile_Full_Access_Object. (Is_Independent_Object): New predicate. (Is_Subcomponent_Of_Atomic_Object): Remove redundant test. (Is_Volatile_Full_Access_Object): New predicate. (Is_Volatile_Prefix): Rename into... (Prefix_Has_Volatile_Components): ... and call Is_Volatile_Object. (Object_Has_Volatile_Components): Delete. (Is_Volatile_Object): Simplify. * gcc-interface/trans.c (node_is_volatile_full_access): Adjust comment. From-SVN: r279429
2019-12-16[Ada] Fix couple of oversights in the implementation of AI12-0128Eric Botcazou1-130/+145
2019-12-16 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * sem_prag.adb (Atomic_Components): Remove local variable and fix consistency issues. Call Component_Type on the Etype of E. (Independent_Components): Remove local variable. * sem_util.adb (Is_Subcomponent_Of_Atomic_Object): Properly deal with prefixes that are access values. * gcc-interface/trans.c (atomic_acces_t): New enumeral type. (node_is_atomic) <N_Indexed_Component>: Test the prefix. (node_has_volatile_full_access): Rename into... (node_is_volatile_full_access): ...this. (node_is_component): New predicare. (gnat_strip_type_conversion): Delete. (outer_atomic_access_required_p): Likewise. (atomic_access_required_p): Rename into... (get_atomic_access): ...this. Implement the 3 different semantics of Atomic and Volatile_Full_Access. (simple_atomic_access_required_p): New predicate. (Call_to_gnu): Remove outer_atomic_access parameter and change the type of atomic_access parameter to atomic_acces_t. Replace call to atomic_access_required_p with simple_atomic_access_required_p for the in direction and call get_atomic_access for the out direction instead of [outer_]atomic_access_required_p. (lhs_or_actual_p): Constify local variables. (present_in_lhs_or_actual_p): Likewise. (gnat_to_gnu) <N_Identifier>: Replace call to atomic_access_required_p with simple_atomic_access_required_p. <N_Explicit_Dereference>: Likewise. <N_Indexed_Component>: Likewise. <N_Selected_Component>: Likewise. <N_Assignment_Statement>: Call get_atomic_access for the name instead of [outer_]atomic_access_required_p. Adjust call to Call_to_gnu. <N_Function_Call>: Adjust call to Call_to_gnu. (get_controlling_type): Fix typo in comment. From-SVN: r279427
2019-12-16[Ada] Implement RM C.6(19) clause entirely in the front-endEric Botcazou1-48/+6
2019-12-16 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * exp_ch6.adb (Requires_Atomic_Or_Volatile_Copy): New predicate. (Expand_Actuals): Use it to decide whether to add call by copy code as per the RM C.6(19) clause. * fe.h (Is_Atomic_Object): Remove. (Is_Volatile_Object): Likewise. * sem_util.ads (Is_Atomic_Object): Remove WARNING note. (Is_Volatile_Object): Likewise. * gcc-interface/trans.c (atomic_or_volatile_copy_required_p): Delete. (Call_to_gnu): Do not implement the RM C.6(19) clause. From-SVN: r279414
2019-12-13[Ada] Deallocation of controlled type implementing interface typesJavier Miranda1-3/+4
2019-12-13 Javier Miranda <miranda@adacore.com> gcc/ada/ * exp_disp.ads (Expand_Interface_Thunk): Adding one formal (the interface type). * exp_disp.adb (Expand_Interface_Thunk): Using the added formal to ensure the correct profile of the thunk generated for predefined primitives; in addition, the added formal is also used to perform a check that ensures that the controlling type of the thunk is the one expected by the GCC backend. (Make_Secondary_DT, Register_Primitive): Adding the new formal to the calls to Expand_Interface_Thunk. * exp_ch6.adb (Register_Predefined_DT_Entry): Adding the new formal to the call to Expand_Interface_Thunk. * exp_intr.adb (Expand_Unc_Deallocation): When deallocating a controlled type and the call to unchecked deallocation is performed with a pointer to one of the convered interface types, displace the pointer to the object to reference the base of the object to deallocate its memory. * gcc-interface/trans.c (maybe_make_gnu_thunk): Assert that the controlling type of the thunk is an interface type. From-SVN: r279351
2019-11-25re PR ada/92362 (double elaboration of expression in Address aspect)Eric Botcazou1-4/+4
PR ada/92362 * gcc-interface/trans.c (gnat_to_gnu) <N_Attribute_Definition_Clause>: Use a temporary instead of clobbering the result with a freeze node. From-SVN: r278675
2019-10-11decl.c (elaborate_reference_1): Specifically deal with pointer displacement.Eric Botcazou1-2/+2
* 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_entity): New case to deal with the definition of named ↵Eric Botcazou1-8/+21
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-23trans.c (Regular_Loop_to_gnu): Do not rotate the loop if -Og is enabled.Eric Botcazou1-4/+7
* gcc-interface/trans.c (Regular_Loop_to_gnu): Do not rotate the loop if -Og is enabled. (build_return_expr): Do not perform NRV if -Og is enabled. (Subprogram_Body_to_gnu): Likewise. (gnat_to_gnu) <N_Simple_Return_Statement>: Likewise. (Handled_Sequence_Of_Statements_to_gnu): Do not inline finalizers if -Og is enabled. * gcc-interface/utils.c (convert_to_index_type): Return early if -Og is enabled. From-SVN: r276047
2019-09-23trans.c (gnat_compile_time_expr_list): New variable.Eric Botcazou1-12/+32
* gcc-interface/trans.c (gnat_compile_time_expr_list): New variable. (Pragma_to_gnu): Rename local variable. Save the (first) expression of pragma Compile_Time_{Error|Warning} for later processing. (Compilation_Unit_to_gnu): Process the expressions saved above. From-SVN: r276045
2019-09-23trans.c (Attribute_to_gnu): Test Can_Use_Internal_Rep on the underlying type ↵Eric Botcazou1-25/+23
of the node. * gcc-interface/trans.c (Attribute_to_gnu): Test Can_Use_Internal_Rep on the underlying type of the node. (Call_to_gnu): Likewise with the type of the prefix. From-SVN: r276041
2019-08-30decl.c (maybe_saturate_size): New function.Eric Botcazou1-1/+1
* 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-19/+11
* 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-30trans.c (gnat_to_gnu): Do not set the location on an expression used for a tag.Eric Botcazou1-2/+8
* gcc-interface/trans.c (gnat_to_gnu): Do not set the location on an expression used for a tag. From-SVN: r275197
2019-08-30trans.c (lvalue_required_p): Adjust GNU_TYPE in the recursive call.Eric Botcazou1-4/+6
* gcc-interface/trans.c (lvalue_required_p) <N_Slice>: Adjust GNU_TYPE in the recursive call. <N_Selected_Component>: Likewise. From-SVN: r275191
2019-08-30* gcc-interface/trans.c (Attribute_to_gnu) <Attr_Size>: Add assertion.Eric Botcazou1-0/+3
From-SVN: r275187
2019-08-30gigi.h (gigi_checking_assert): New macro.Eric Botcazou1-123/+44
* 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-08-19[Ada] Fix thinko in Acc_Loop_to_gnuOlivier Hainque1-4/+1
This fixes a glitch introduced during the initial OpenACC work import process, causing crashes on any Acc_Parallel + Acc_Loop combination. 2019-08-19 Olivier Hainque <hainque@adacore.com> gcc/ada/ * gcc-interface/trans.c (Acc_Loop_to_gnu): Return the openacc BIND_EXPR node we have constructed on purpose. Remove unused variable. gcc/testsuite/ * gnat.dg/openacc1.adb: New testcase. From-SVN: r274638