aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
AgeCommit message (Collapse)AuthorFilesLines
2020-07-10[Ada] Fix memory leak in routine Wait_On_SocketPascal Obry1-7/+15
gcc/ada/ * libgnat/g-socket.adb (Wait_On_Socket): Fix memory leaks and file descriptor leaks. A memory leak was created each time the routine was called without a selector (Selector = Null). Also, in case of exception in the routine a memory leak and descriptor leak was created as the created file selector was not closed.
2020-07-10[Ada] Minor style fixesPascal Obry1-8/+10
gcc/ada/ * libgnat/g-socket.adb: Minor style fixes.
2020-07-10[Ada] Potentially unevaluated nested expressionsJavier Miranda1-92/+119
gcc/ada/ * sem_util.adb (Immediate_Context_Implies_Is_Potentially_Unevaluated): New subprogram. (Is_Potentially_Unevaluated): Do not stop climbing the tree on the first candidate subexpression; required to handle nested expressions.
2020-07-10[Ada] Reformatting and typo correctionsGary Dismukes5-67/+68
gcc/ada/ * exp_aggr.adb, exp_spark.adb, sem_ch13.ads, sem_ch13.adb, snames.ads-tmpl: Minor reformatting and typo fixes.
2020-07-10[Ada] Fix detection of volatile properties in SPARKYannick Moy1-0/+8
gcc/ada/ * sem_util.adb (Has_Enabled_Property): Add handling of non-variable objects.
2020-07-10[Ada] Cleanup excessive conditions in Check_CompletionPiotr Trojanek1-15/+17
gcc/ada/ * sem_ch3.adb (Check_Completion): Refactor chained if-then-elsif-... statement to be more like a case statement (note: we can't simply use case statement because of Is_Intrinsic_Subprogram in the first condition).
2020-07-10[Ada] Remove references to non-existing E_Protected_ObjectPiotr Trojanek4-21/+2
gcc/ada/ * einfo.ads (E_Protected_Object): Enumeration literal removed. * lib-xref.ads (Xref_Entity_Letters): Remove reference to removed literal. * sem_ch3.adb (Check_Completion): Likewise. * sem_util.adb (Has_Enabled_Property): Likewise.
2020-07-10[Ada] Use small limit for aggregates inside subprogramsArnaud Charlet14-174/+196
gcc/ada/ * exp_aggr.adb (Max_Aggregate_Size): Use small limit for aggregate inside subprograms. * sprint.adb (Sprint_Node_Actual [N_Object_Declaration]): Do not print the initialization expression if the No_Initialization flag is set. * sem_util.ads, sem_util.adb (Predicate_Enabled): New. * exp_ch4.adb (Expand_N_Type_Conversion): Code cleanup and apply predicate check consistently. * exp_ch6.adb (Expand_Actuals.By_Ref_Predicate_Check): Ditto. * sem_ch3.adb (Analyze_Object_Declaration): Ditto. * exp_ch3.adb (Build_Assignment): Revert handling of predicate check for allocators with qualified expressions, now handled in Freeze_Expression directly. * sem_aggr.adb: Fix typos. * checks.adb: Code refactoring: use Predicate_Enabled. (Apply_Predicate_Check): Code cleanup. * freeze.adb (Freeze_Expression): Freeze the subtype mark before a qualified expression on an allocator. * exp_util.ads, exp_util.adb (Within_Internal_Subprogram): Renamed Predicate_Check_In_Scope to clarify usage, refine handling of predicates within init procs which should be enabled when the node comes from source. * sem_ch13.adb (Freeze_Entity_Checks): Update call to Predicate_Check_In_Scope.
2020-07-10[Ada] Small cleanup throughout Exp_Ch4Eric Botcazou1-33/+32
gcc/ada/ * exp_ch4.adb (Expand_Array_Comparison): Reformat. (Expand_Concatenate): Use standard size values directly and use Standard_Long_Long_Unsigned instead of RE_Long_Long_Unsigned. (Expand_Modular_Op): Use Standard_Long_Long_Integer in case the modulus is larger than Integer. (Expand_N_Op_Expon): Use standard size value directly. (Narrow_Large_Operation): Use Uint instead of Nat for sizes and use a local variable for the size of the type. (Get_Size_For_Range): Return Uint instead of Nat. (Is_OK_For_Range): Take Uint instead of Nat.
2020-07-10[Ada] Spurious error in generic dispatching constructor callJavier Miranda1-1/+2
gcc/ada/ * exp_ch6.adb (Make_Build_In_Place_Iface_Call_In_Allocator): Build the internal anonymous access type using as a reference the designated type imposed by the context (instead of using the return type of the called function).
2020-07-10[Ada] Fix assertion failure on (in-)out function parameterYannick Moy1-0/+1
gcc/ada/ * sem_res.adb (Resolve_Actuals): Protect call to Is_Valued_Procedure.
2020-07-10[Ada] Revert too late setting of Ekind on discriminantsPiotr Trojanek1-3/+6
gcc/ada/ * sem_ch3.adb (Process_Discriminants): Revert recent change to location of Set_Ekind; detect effectively volatile discriminants by their type only.
2020-07-10[Ada] Add global contracts to Ada.Numerics.Big_Numbers librariesJoffrey Huguet2-76/+135
gcc/ada/ * libgnat/a-nbnbin.ads, libgnat/a-nbnbre.ads: Add global contract (Global => null) to all functions.
2020-07-10[Ada] Part of implementation of AI12-0212: container aggregatesEd Schonberg8-2/+460
gcc/ada/ * aspects.ads: Add Aspect_Aggregate. * exp_aggr.adb (Expand_Container_Aggregate): Expand positional container aggregates into separate initialization and insertion operations. * sem_aggr.ads (Resolve_Container_Aggregate): New subprogram. * sem_aggr.adb (Resolve_Container_Aggregate): Parse aspect aggregate, establish element types and key types if present, and resolve aggregate components. * sem_ch13.ads (Parse_Aspect_Aggregate): Public subprogram used in validation, resolution and expansion of container aggregates * sem_ch13.adb (Parse_Aspect_Aggregate): Retrieve names of primitives specified in aspect specification. (Validate_Aspect_Aggregate): Check legality of specified operations given in aspect specification, before nane resolution. (Resolve_Aspect_Aggregate): At freeze point resolve operations and verify that given operations have the required profile. * sem_res.adb (Resolve): Call Resolve_Aspect_Aggregate if aspect is present for type. * snames.ads-tmpl: Add names used in aspect Aggregate: Empty, Add_Named, Add_Unnamed, New_Indexed, Assign_Indexed.
2020-07-10[Ada] Make System.Generic_Bignums more flexibleArnaud Charlet8-394/+625
gcc/ada/ * Makefile.rtl (GNATRTL_NONTASKING_OBJS): Add s-shabig.o. * libgnat/s-shabig.ads: New file to share definitions. * libgnat/s-genbig.ads, libgnat/s-genbig.adb: Reorganized to make it more generic and flexible in terms of memory allocation and data structure returned. (To_String): Moved to System.Generic_Bignums to allow sharing this code. (Big_And, Big_Or, Big_Shift_Left, Big_Shift_Right): New. * libgnat/s-bignum.adb, libgnat/s-bignum.ads: Adapt to new System.Generic_Bignums spec. * libgnat/a-nbnbin.adb: Likewise. (To_String): Moved to System.Generic_Bignums to allow sharing this code. * libgnat/a-nbnbre.adb (Normalize): Fix handling of Num = 0 leading to an exception.
2020-07-10[Ada] Fix crash on quantified expression in expression function (2)Eric Botcazou1-2/+3
gcc/ada/ * freeze.adb (Freeze_Expr_Types): Replace call to Find_Aspect with call to Find_Value_Of_Aspect and adjust accordingly.
2020-07-10[Ada] Fix crash on quantified expression in expression functionEric Botcazou2-0/+17
gcc/ada/ * einfo.adb (Write_Field24_Name): Handle E_Loop_Parameter. * freeze.adb (Freeze_Expr_Types): Freeze the iterator type used as Default_Iterator of the name of an N_Iterator_Specification node.
2020-07-10[Ada] Fix internal error on if-expression in call returning tagged typeEric Botcazou3-6/+34
gcc/ada/ * checks.adb (Determine_Range): Deal with Min and Max attributes. * exp_ch6.adb (Expand_Call_Helper): When generating code to pass the accessibility level to the caller in the case of an actual which is an if-expression, also remove the nodes created after the declaration of the dummy temporary. * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Use Natural as the type of the minimum accessibility level object.
2020-07-10[Ada] Fix failing assertions related to volatile objectsPiotr Trojanek3-8/+15
gcc/ada/ * sem_ch3.adb (Process_Discriminants): Set Ekind of the processed discriminant entity before passing to Is_Effectively_Volatile, which was crashing on a failed assertion. * sem_prag.adb (Analyze_External_Property_In_Decl_Part): Prevent call to No_Caching_Enabled with entities other than variables, which was crashing on a failed assertion. (Analyze_Pragma): Style cleanups. * sem_util.adb (Is_Effectively_Volatile): Enforce comment with an assertion; prevent call to No_Caching_Enabled with entities other than variables. (Is_Effectively_Volatile_Object): Only call Is_Effectively_Volatile on objects, not on types. (No_Caching_Enabled): Enforce comment with an assertion.
2020-07-10[Ada] Remove use of debug flag -gnatdF for GNATproveYannick Moy1-7/+1
gcc/ada/ * debug.adb: Update comments to free usage of -gnatdF.
2020-07-10[Ada] Reuse SPARK expansion of attribute Update for delta_aggregatePiotr Trojanek1-160/+198
gcc/ada/ * exp_spark.adb (Expand_SPARK_Delta_Or_Update): Refactored from Expand_SPARK_N_Attribute_Reference; rewrite into N_Aggregate or N_Delta_Aggregate depending on what is being rewritten. (Expand_SPARK_N_Delta_Aggregate): New routine to expand delta_aggregate. (Expand_SPARK_N_Attribute_Reference): Call the refactored routine.
2020-07-10[Ada] Fix expansion of 'Update with multiple choices in GNATprovePiotr Trojanek1-9/+57
gcc/ada/ * exp_spark.adb (Expand_SPARK_N_Attribute_Reference): Fix expansion of attribute Update.
2020-07-10[Ada] Crash in Walk_Library_Items on ghost unitsArnaud Charlet1-1/+5
gcc/ada/ * sem.adb (Walk_Library_Items): Fix handling of Ghost units.
2020-07-09Daily bump.GCC Administrator1-0/+275
2020-07-08[Ada] Disable warning about unsafe use of __builtin_frame_addressEric Botcazou1-0/+3
gcc/ada/ * tracebak.c [generic implementation]: Add pragma GCC diagnostic to disable warning about __builtin_frame_address.
2020-07-08[Ada] Fix C miss parentheses warning on WindowsDmitriy Anisimkov1-6/+4
gcc/ada/ * socket.c [_WIN32] (__gnat_minus_500ms): Parentheses around && operations. Remove notes about TN in comment.
2020-07-08[Ada] Fix warnings in C runtime files on WindowsEric Botcazou6-75/+64
gcc/ada/ * adaint.h (__gnat_expect_portable_execvp): Fix prototype. (__gnat_expect_poll): Likewise. * expect.c [_WIN32]: Include adaint.h file. (__gnat_waitpid): Remove useless variable. (__gnat_expect_portable_execvp): Add ATTRIBUTE_UNUSED on parameter. * raise-gcc.c [SEH] (__gnat_personality_v0): Add ATTRIBUTE_UNUSED. * socket.c [_WIN32] (__gnat_getservbyport): Add ATTRIBUTE_UNUSED on a couple of parameters. (__gnat_gethostbyname): Likewise. (__gnat_gethostbyaddr): Likewise. (__gnat_getservbyname): Likewise. (__gnat_last_socket_in_set): Use variables local to loops. (__gnat_socket_ioctl): Cast 3rd parameter to proper type if _WIN32. (__gnat_inet_pton): Cast 2nd parameter to proper type if _WIN32. * sysdep.c (__gnat_localtime_tzoff): Remove superfluous test. * terminals.c [_WIN32]: Include io.h file. (is_gui_app): Remove useless variables and fix unsigned comparison. (nt_spawnve): Add ATTRIBUTE_UNUSED on first parameter. Initialize a local variable and remove others that are useless. Add missing cast (__gnat_setup_child_communication): Remove useless variable and call Use proper formatting string in call to sprintf. (__gnat_setup_parent_communication): Cast to proper type. (find_child_console): Fix prototype and remove useless variable. (find_process_handle): Likewise. (_gnat_interrupt_process): Move to after __gnat_interrupt_pid. (__gnat_reset_tty): Add ATTRIBUTE_UNUSED on parameter, remove return (__gnat_setup_winsize): Add ATTRIBUTE_UNUSED on all parameters.
2020-07-08[Ada] Do not apply constraint checks on allocator with No_InitializationEric Botcazou1-2/+3
gcc/ada/ * exp_ch4.adb (Expand_N_Allocator): In the subtype mark case, do not apply constraint checks if the No_Initialization flag is set.
2020-07-08[Ada] Fix recent regression on _Master declarationJavier Miranda1-1/+12
gcc/ada/ * exp_ch9.adb (Build_Class_Wide_Master): Insert the declaration of _Master before its use; required to avoid assertion failure in the backend.
2020-07-08[Ada] Clean up in Interfaces.C.ExtensionsArnaud Charlet3-5/+3
gcc/ada/ * libgnat/i-cexten.ads (long_long, unsigned_long_long): Now subtypes of Interfaces.C types. * libgnat/a-calcon.ads, libgnat/a-calcon.adb (To_Unix_Nano_Time): Use Interfaces.C.long_long instead of Interfaces.C.Extensions.long_long.
2020-07-08[Ada] Optional warning on build-in-place function callsVasiliy Fofanov2-1/+28
gcc/ada/ * debug.adb: Document new switch. * exp_ch6.adb (Warn_BIP): New function that warns if the switch is on. Call it from Make_Build_In_Place_* functions. Warn_BIP is not needed in Make_Build_In_Place_Iface_*, because those call Make_Build_In_Place_Call_In_Object_Declaration or similar.
2020-07-08[Ada] Fix typo and layout in comments about matchingPiotr Trojanek1-6/+6
gcc/ada/ * erroutc.adb (Matches): Fix comments.
2020-07-08[Ada] Fix internal error on string type comparision with predicateEric Botcazou1-16/+71
gcc/ada/ * freeze.adb (Has_Decl_In_List): New predicate to check that an entity is declared in a list of nodes. (Freeze_Expression): Use it to deal with Expression_With_Actions, short-circuit expression, if- and case-expression and ensure that the freeze node is put onto their Actions list if the entity is declared locally.
2020-07-08[Ada] Fix incorrect placement of freeze node with predicateEric Botcazou1-5/+12
gcc/ada/ * freeze.adb (In_Expanded_Body): Return true for the body of a generated predicate function.
2020-07-08[Ada] Minor reformatting and typo fixGary Dismukes3-9/+9
gcc/ada/ * sem_attr.adb: Remove hyphens in comments, plus minor code reformatting. * sem_ch13.adb: Fix typo (that => than). * sem_util.adb: Add hyphen in comment ("class-wide").
2020-07-08[Ada] Add comment on implementation choice for byte-packed array typesEric Botcazou1-1/+4
gcc/ada/ * freeze.adb (Freeze_Array_Type): Add comment on implementation choice for byte-packed array types.
2020-07-08[Ada] Accept aspect Relaxed_Initialization on generic subprogramsPiotr Trojanek4-16/+28
gcc/ada/ * sem_attr.adb (Analyze_Attribute): Correct prefix of 'Result this prefix is a generic function but the enclosing aspect or pragma is attached to its instance. * sem_ch12.adb (Analyze_Generic_Subprogram_Declaration): Analyze generic subprogram formal parameters (including the implicit result of a generic function) and only then analyse its aspects, because with Relaxed_Initialization the aspect expression might refer to those formal parameters. * sem_ch13.adb (Analyze_Aspect_Relaxed_Initialization): Accept aspect on generic subprograms; install formal parameters of a generic subprogram but not formal parameters of the generic unit itself (the previous code was inspired by aspects Post and Depends, where both kinds of formals are allowed). * sem_util.ads (Enter_Name): Fix name of a subprogram referenced in comment.
2020-07-08[Ada] Analyze aspects once generic subprograms are recognizedPiotr Trojanek2-23/+7
gcc/ada/ * sem_ch12.adb (Analyze_Generic_Subprogram_Declaration): Call Analyze_Aspect_Specifications after setting Ekind of the analyzed entity. * sem_ch13.adb (Analyze_Aspect_Yield): Remove minimal decoration of generic subprograms.
2020-07-08[Ada] ACATS 4.1R - BD10001 - Error missedArnaud Charlet7-10/+34
gcc/ada/ * sem_prag.adb (Process_Inline): Check for duplicate pragma+aspect Inline. Minor code cleanup. (Check_Duplicate_Pragma): Add warning for duplicate pragma [No_]Inline under -gnatwr. * sinfo.ads, sinfo.adb (Next_Rep_Item): Allow N_Null_Statement which can appear when a pragma is rewritten. * sem_util.ads, sem_util.adb, bindo-writers.adb: Fix bad copy/paste now flagged. * libgnat/s-mmap.ads: Remove redundant pragma Inline.
2020-07-08[Ada] Update entities on class-wide condition function creationEd Schonberg1-1/+22
gcc/ada/ * sem_util.adb (Build_Class_Wide_Clone_Body): Update entities to refer to the right spec.
2020-07-08[Ada] Disallow Predicate_Failure without predicateBob Duff1-10/+6
gcc/ada/ * sem_ch13.adb (Predicate_Failure): Check that the type has predicates. Remove the setting of Has_Delayed_Aspects and Freeze_Node, because (if the code is legal) it should have already been done by the predicate aspect.
2020-07-08[Ada] Typo corrections, plus minor reformatting in commentsGary Dismukes1-3/+3
gcc/ada/ * par-ch4.adb (P_Iterated_Component_Association): Typo corrections.
2020-07-08[Ada] Ada_2020 AI12-0250 : Implement Iterator filters.Ed Schonberg8-26/+152
gcc/ada/ * par.adb (P_Iterator_Specification): Make public for use in other parser subprograms. * par-ch4.adb (P_Iterated_Component_Association): In Ada_2020, recognize use of Iterator_Specification in an element iterator. To simplify disambiguation between the two iterator forms, mark the component association as carrying an Iterator_Specification only when the element iterator (using "OF") is used. * par-ch5.adb (P_Loop_Parameter_Specification): In Ada_2020, parse iterator filter when present. (P_Iterator_Specification): Ditto. Remove declaration of P_Iterator_Specification, now in parent unit. * exp_ch5.adb (Expand_N_Loop_Statement): Apply Iterator filter when present. (Expand_Iterator_Loop_Over_Array): Ditto. (Expand_Iterator_Loop_Over_Container): Ditto. * sem_aggr.adb (Resolve_Array_Aggregate): Emit error nessage if an iterated component association includes a iterator specificcation with an element iterator, i.e. one that uses the OF keyword. * sem_ch5.adb (Analyze_Iterator_Specification): Analyze Iterator filter when present. (Analyze_Loop_Parameter_Specification): Ditto. * sinfo.adb: Suprogram bodies for new syntactic element Iterator_Filter. * sinfo.ads: Add Iterator_Filter to relevant nodes. Structure of Component_Association and Iteroted_Component_Association nodes is modified to take into account the possible presence of an iterator specification in the latter.
2020-07-08[Ada] Add utility function to recognize attribute 'Loop_EntryYannick Moy2-0/+13
gcc/ada/ * sem_util.ads, sem_util.adb (Is_Attribute_Loop_Entry): New function for GNATProve.
2020-07-08[Ada] Add expected and actual size to "bit number out of range" error messageGhjuvan Lacambre1-4/+8
gcc/ada/ * sem_ch13.adb (Analyze_Record_Representation_Clause, Check_Record_Representation_Clause): Add expected and actual size to error message.
2020-07-08[Ada] Remove excessive validity checks on in-parametersPiotr Trojanek2-15/+18
gcc/ada/ * sem_util.ads, sem_util.adb (Safe_To_Capture_Value): Return True for in-parameters.
2020-07-08[Ada] Minor refactoringJustin Squirek2-8/+9
gcc/ada/ * exp_attr.adb (Expand_Attribute): Set Stores_Attribute_Old_Prefix to generated renamings of 'Old constants for later use in generating finalization routines. * exp_ch7.adb (Build_Finalizer): Minor reformatting. Use "or else" operators.
2020-07-08[Ada] Static expression function problems with -gnatc and -gnatd.F (SPARK mode)Gary Dismukes4-39/+28
gcc/ada/ * exp_ch6.adb (Expand_Simple_Function_Return): Remove ugly code that was copying the return expression, resetting Analyzed flags, etc. for the return expression of static expression functions. * inline.adb (Inline_Static_Expression_Function_Call): Set the Parent of the copied expression to that of the call. This avoids a blowup in Insert_Actions when GNATprove_Mode is set and there are nested SEF calls. Add ??? comment. * sem_ch6.adb (Analyze_Expression_Function): In the case of a static expression function, create a new copy of the expression and replace the function's expression with the copy; the original expression is used in the expression function's body and will be analyzed and rewritten, and we need to save a clean copy for later use in processing static calls to the function. This allows removing the kludgy code that was in Expand_Simple_Function_Return. * sem_eval.adb (Eval_Qualified_Expression): Return immediately if any errors have been posted on the qualified expression, to avoid blowups when GNATprove_Mode is enabled (or with -gnatd.F), since illegal static expressions are handled differently in that case and attempting to fold such expressions would fail.
2020-07-08[Ada] Fix inaccurate -gnatR output for derived untagged typesEric Botcazou1-9/+14
gcc/ada/ * repinfo.adb (Compute_Max_Length): Skip hidden discriminants. (List_Record_Layout): Likewise. (List_Structural_Record_Layout): Use First_Discriminant instead of First_Stored_Discriminant and Next_Discriminant instead of Next_Stored_Discriminant to walk the list of discriminants.
2020-07-08[Ada] Allow boolean expressions in aspect Relaxed_InitializationPiotr Trojanek3-9/+63
gcc/ada/ * sem_ch13.adb (Analyze_Aspect_Relaxed_Initialization): Analyze optional boolean expressions. * sem_util.ads, sem_util.adb (Has_Relaxed_Initialization): Adapt query; update comment.