aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
AgeCommit message (Collapse)AuthorFilesLines
2020-10-15[Ada] Fix access to uninitialized global variable when emitting errorPiotr Trojanek1-1/+1
gcc/ada/ * sem_util.adb (Bad_Predicated_Subtype_Use): Emit an unconditional error, not a conditional warning.
2020-10-15[Ada] Cleanup defensive guards for Null_Exclusion_PresentPiotr Trojanek1-11/+13
gcc/ada/ * sem_ch3.adb (Process_Subtype): Combine guards for Null_Exclusion_Present in May_Have_Null_Exclusion; use this combined guard when checking AI-231.
2020-10-15[Ada] Bring defensive guard for Null_Exclusion_Present up to datePiotr Trojanek1-9/+13
gcc/ada/ * sem_ch3.adb (Process_Subtype): Sync May_Have_Null_Exclusion with assertion in Null_Exclusion_Present; clarify the scope of local variables.
2020-10-15[Ada] Explain predicate function not being inherited by index typePiotr Trojanek1-10/+15
gcc/ada/ * sem_ch3.adb (Analyze_Subtype_Declaration): Fix style. (Make_Index): Refactor to avoid repeated detection of subtype indication; add comment.
2020-10-15[Ada] Adjust style in support for CUDA_Execute pragmaPiotr Trojanek1-8/+8
gcc/ada/ * sem_prag.adb (Is_Acceptable_Dim3): Use Is_RTE to not pull CUDA package unless necessary; rename local Tmp variable; iterate with procedural Next.
2020-10-15[Ada] Avoid unnecessary (re)assignments in Make_InfoPiotr Trojanek2-16/+13
gcc/ada/ * sem_ch3.adb (Array_Type_Declaration): Refine type of a local variable. (Make_Index): Simplify to avoid assignment with a type entity and then backtracking by reassigning to Empty; remove excessive whitespace. * sem_ch9.adb (Analyze_Entry_Body): Remove extra parens.
2020-10-15[Ada] Remove excessive defensive calls to Is_TypePiotr Trojanek1-3/+1
gcc/ada/ * sem_ch3.adb (Access_Subprogram_Declaration): Remove extra parens. (Make_Index): Remove excessive calls to Is_Type.
2020-10-15[Ada] Code cleanupArnaud Charlet1-11/+2
gcc/ada/ * sem_util.adb (Enter_Name): Remove unnecessary conditions in Enter_Name that come from the beginning of times.
2020-10-15[Ada] Remove obsolete DSP commentBob Duff1-9/+8
gcc/ada/ * exp_ch6.adb (Expand_Simple_Function_Return): Remove DSP part of comment, and reformat.
2020-10-15[Ada] Do not expand 'Initialized in codepeer modeBoris Yakobowski1-0/+8
gcc/ada/ * exp_attr.adb (Expand_N_Attribute_Reference): Do not expand 'Initialized in CodePeer mode.
2020-10-15[Ada] Assert failure on incorrect codeArnaud Charlet1-1/+6
gcc/ada/ * sem_ch12.adb (Reset_Entity): Protect against malformed tree.
2020-10-15[Ada] Double evaluation of predicateArnaud Charlet1-1/+1
gcc/ada/ * sem_ch13.adb (Add_Predicates): Prevent analyzing twice the same pragma in case an inner package references the type with a predicate (as opposed to defining the type).
2020-10-15[Ada] Do not use maximal values from System in runtime unitsEric Botcazou5-9/+5
gcc/ada/ * libgnat/a-cfinve.adb (Int): Use subtype of Long_Long_Integer. * libgnat/a-cofove.adb (Int): Likewise. * libgnat/a-cgcaso.adb (T): Likewise. * libgnat/a-cogeso.adb (T): Likewise. * libgnat/g-debpoo.ads (Byte_Count): Use Long_Long_Integer'Size.
2020-10-15[Ada] Simplify membership tests with N_Entity subtypePiotr Trojanek1-10/+3
gcc/ada/ * sem_ch12.adb: Replace list of N_Defining_... enumerations with N_Entity.
2020-10-15[Ada] Refine type from Nat to Pos in Make_IndexPiotr Trojanek2-6/+6
gcc/ada/ * sem_ch3.ads, sem_ch3.adb (Make_Index): Refined type of parameter. (Constrain_Index): Likewise. (Array_Type_Declaration): Refine type of a local counter variable; remove a trivially useless initialization.
2020-10-15[Ada] Fix range check on constrained array with expanded index namePiotr Trojanek1-2/+2
gcc/ada/ * sem_ch3.adb (Analyze_Subtype_Declaration): Recognize both identifiers and expanded names; use high-level Is_Scalar_Type instead of low-level membership test.
2020-10-15[Ada] Add support for compile time evaluation of Shift_Right_ArithmeticArnaud Charlet2-50/+127
gcc/ada/ * sem_eval.adb (Eval_Intrinsic_Call, Fold_Shift): Add support for Shift_Right_Arithmetic and for signed integers. * exp_ch4.adb (Expand_N_Op_Rotate_Left, Expand_N_Op_Rotate_Right, Expand_N_Op_Shift_Left, Expand_N_Op_Shift_Right_Arithmetic): Minor reformatting and code cleanup to ensure a consistent handling. Update comments and add assertion.
2020-10-15[Ada] Ada2020: AI12-0180 Using subprograms and entries in invariantsBob Duff2-10/+19
gcc/ada/ * sem_ch13.adb (Visible_Component): Enable this code for task and protected types, as well as record and private types. * sem_ch13.ads (Replace_Type_References_Generic): Update comment. Move the efficiency comment into the body, because it's about the implementation.
2020-10-15[Ada] Warn on unknown aspectArnaud Charlet2-6/+8
gcc/ada/ * par-ch13.adb (Get_Aspect_Specifications): Generate a warning rather than an error on unknown aspects unless -gnatd2 is used. (Aspect_Specifications_Present): Improve detection of unknown aspects. * debug.adb (Debug_Flag_2): Update document.
2020-10-15[Ada] Complete support for static intrinsic functionsArnaud Charlet1-0/+1
gcc/ada/ * sem_res.adb (Resolve_Call): Do not try to inline intrinsic calls.
2020-10-15[Ada] Ada_2020: Add aspect Aggregate to standard container unitsEd Schonberg24-26/+200
gcc/ada/ * exp_aggr.adb (Expand_N_Aggregate): A record aggregate requires a non-private type. * sem_ch13.adb (Valid_Assign_Indexed): New subprogram local to Resolve_Aspect_Aggregate, to handle the case when the corresponding name appearing in the aspect specification for an indexed aggregate is an overloaded operation. * libgnat/a-convec.ads, libgnat/a-convec.adb, libgnat/a-coinve.ads, libgnat/a-coinve.adb, libgnat/a-cobove.ads, libgnat/a-cobove.adb, libgnat/a-cdlili.ads, libgnat/a-cdlili.adb, libgnat/a-cbdlli.ads, libgnat/a-cbdlli.adb, libgnat/a-cohama.ads, libgnat/a-cihama.ads, libgnat/a-cbhama.ads, libgnat/a-cborma.ads, libgnat/a-ciorma.ads, libgnat/a-coorma.ads, libgnat/a-cihase.ads, libgnat/a-cohase.ads, libgnat/a-cbhase.ads, libgnat/a-cborse.ads, libgnat/a-ciorse.ads, libgnat/a-coorse.ads: Add Ada_2020 aspect Aggregate to types declared in standard containers, as well as new subprograms where required.
2020-10-15[Ada] Add iterators over GNAT.Array_Split.Slice_SetArnaud Charlet2-11/+51
gcc/ada/ * libgnat/g-arrspl.ads, libgnat/g-arrspl.adb (Create, First_Cursor, Advance, Has_Element): New.
2020-10-15[Ada] AI12-0385 Predefined shifts and rotates should be staticArnaud Charlet4-4/+212
gcc/ada/ * Makefile.rtl: Add target pair for interfac.ads. * libgnat/interfac.ads: Add a comment. * libgnat/interfac__2020.ads: New, used for bootstrap purposes. * sem_util.adb (Is_Static_Function): Always return False for pre Ada 2020 to e.g. ignore the Static aspect in Interfaces for Ada < 2020.
2020-10-15[Ada] Do not remove side effects from any object declarations in SPARKPiotr Trojanek1-10/+9
gcc/ada/ * exp_util.adb (Remove_Side_Effects): Move special-casing for GNATprove to be applied to all object declarations.
2020-10-13Daily bump.GCC Administrator1-0/+5
2020-10-12make sin and cos generics inlineableAlexandre Oliva1-0/+2
Enable the sincos optimization within callers of these (single-argument) elementary functions. for gcc/ada/ChangeLog * libgnat/a-ngelfu.ads (Sin, Cos): Make the single-argument functions inline.
2020-10-12Daily bump.GCC Administrator1-0/+7
2020-10-11import elementary functions as intrinsicsAlexandre Oliva4-50/+50
Importing them as intrinsics enables GCC to treat them as builtins whose behavior is known by GCC. Specifically, if they aren't intrinsics, calls to Sin and Cos won't be combined into sincos. We still need to make Sin and Cos wrappers inline in user-exposed interfaces to get users the benefit of this transformation. That is forthcoming in a separate patch. for gcc/ada/ChangeLog * libgnat/a-numaux.ads: Make all imports Intrinsic. * libgnat/a-numaux__darwin.ads: Likewise. * libgnat/a-numaux__libc-x86.ads: Likewise. * libgnat/a-numaux__vxworks.ads: Likewise.
2020-09-29Daily bump.GCC Administrator1-0/+11
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-28Fix bogus alignment warning on address clauseEric Botcazou1-8/+20
The compiler gives a bogus alignment warning on an address clause and a discriminated record type with variable size. gcc/ada/ChangeLog: * gcc-interface/decl.c (maybe_saturate_size): Add ALIGN parameter and round down the result to ALIGN. (gnat_to_gnu_entity): Adjust calls to maybe_saturate_size. gcc/testsuite/ChangeLog: * gnat.dg/addr16.adb: New test. * gnat.dg/addr16_pkg.ads: New helper.
2020-09-15Daily bump.GCC Administrator1-0/+5
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-13Daily bump.GCC Administrator1-0/+31
2020-09-12Add preliminary support for 128-bit integer typesEric Botcazou6-2/+40
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-09-12Accept absolute address clause for array of UNC nominal subtypeEric Botcazou1-0/+13
This changes the compiler to accept again absolute address clause for aliased array of unconstrained nominal subtype, instead of erroring out in this case. gcc/ada/ChangeLog: * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Only give a warning for the overlay of an aliased array with an unconstrained nominal subtype if the address is absolute.
2020-09-12Daily bump.GCC Administrator1-0/+22
2020-09-11Fix ICE on nested packed variant record typeEric Botcazou1-5/+32
This is a regression present on the mainline and 10 branch: the compiler aborts on code accessing a component of a packed record type whose type is a packed discriminated record type with variant part. gcc/ada/ChangeLog: * gcc-interface/utils.c (type_has_variable_size): New function. (create_field_decl): In the packed case, also force byte alignment when the type of the field has variable size. gcc/testsuite/ChangeLog: * gnat.dg/pack27.adb: New test. * gnat.dg/pack27_pkg.ads: New helper.
2020-09-11Add missing stride entry in debug infoEric Botcazou1-0/+4
This adds a missing stride entry for bit-packed arrays of record types. gcc/ada/ChangeLog: * gcc-interface/misc.c (get_array_bit_stride): Return TYPE_ADA_SIZE for record and union types.
2020-09-11Drop GNAT encodings for fixed-point typesEric Botcazou1-3/+2
GDB can now deal with the DWARF representation just fine. gcc/ada/ChangeLog: * gcc-interface/misc.c (gnat_get_fixed_point_type): Bail out only when the GNAT encodings are specifically used.
2020-09-11Fix crash on array component with nonstandard index typeEric Botcazou1-6/+6
This is a regression present on mainline, 10 and 9 branches: the compiler goes into an infinite recursion eventually exhausting the stack for the declaration of a discriminated record type with an array component having a discriminant as bound and an index type that is an enumeration type with a non-standard representation clause. gcc/ada/ChangeLog: * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Subtype>: Only create extra subtypes for discriminants if the RM size of the base type of the index type is lower than that of the index type. gcc/testsuite/ChangeLog: * gnat.dg/specs/discr7.ads: New test.
2020-09-11Adjust email addressEric Botcazou1-14/+14
2020-09-11Daily bump.GCC Administrator1-0/+16
2020-09-10Fix bogus error on Value_Size clause for variant record typeEric Botcazou1-2/+4
This is a regression present on the mainline and 10 branch: the compiler rejects a Value_Size clause on a discriminated record type with variant. gcc/ada/ChangeLog: * gcc-interface/decl.c (set_rm_size): Do not take into account the Value_Size clause if it is not for the entity itself. gcc/testsuite/ChangeLog: * gnat.dg/specs/size_clause5.ads: New test.
2020-09-10Fix uninitialized variable with nested variant record typesEric Botcazou1-5/+9
This fixes a wrong code issue with nested variant record types: the compiler generates move instructions that depend on an uninitialized variable, which was initially a SAVE_EXPR not instantiated early enough. gcc/ada/ChangeLog: * gcc-interface/decl.c (build_subst_list): For a definition, make sure to instantiate the SAVE_EXPRs generated by the elaboration of the constraints in front of the elaboration of the type itself. gcc/testsuite/ChangeLog: * gnat.dg/discr59.adb: New test. * gnat.dg/discr59_pkg1.ads: New helper. * gnat.dg/discr59_pkg2.ads: Likewise.
2020-09-10Add emergency dump after an ICEEric Botcazou1-0/+4
This is only for internal debugging purposes. gcc/ada/ChangeLog: * gcc-interface/misc.c: Include tree-pass.h. (internal_error_function): Call emergency_dump_function.
2020-09-04Daily bump.GCC Administrator1-0/+12
2020-09-03Preliminary work on support for 128bits integersArnaud Charlet3-0/+12
* fe.h, opt.ads (Enable_128bit_Types): New. * stand.ads (Standard_Long_Long_Long_Integer, S_Long_Long_Long_Integer): New.