aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
AgeCommit message (Collapse)AuthorFilesLines
2019-09-17[Ada] Add Remove primitive on functional mapsClaire Dross3-0/+32
A primitive for removing a mapping from a functional map has been added. 2019-09-17 Claire Dross <dross@adacore.com> gcc/ada/ * libgnat/a-cofuma.ads, libgnat/a-cofuma.adb (Remove): New function which returns a copy of the input container without a given mapping. From-SVN: r275797
2019-09-17[Ada] Fix rounding of fixed-point arithmetic operationYannick Moy2-8/+40
Fixed-point multiplication, division and conversion may lead to calling the function Double_Divide in s-arit64 runtime unit. In the special case where arguments have the special values X = -2**63 and the absolute value of the product of its other arguments Y*Z = 2**64, the rounded value should be either -1 or 1, but currently Double_Divide returns a quotient of 0. Rounding only applies when Round attribute is called on the arithmetic operation for a decimal fixed-point result, or the result type is integer. This fixes correctly applies rounding away from 0 in that special case. 2019-09-17 Yannick Moy <moy@adacore.com> gcc/ada/ * libgnat/s-arit64.adb (Double_Divide): Correctly handle the special case when rounding. gcc/testsuite/ * gnat.dg/fixedpnt7.adb: New testcase. From-SVN: r275796
2019-09-17[Ada] Missing propagation of Has_Predicates in cloned subtypesJavier Miranda2-0/+17
The frontend silently skips propagating attributes Has_Predicates and Predicate function to the internally built cloned subtype. This change does not affect the functionality of the compiler; it leaves more clean the decoration of internal entities. 2019-09-17 Javier Miranda <miranda@adacore.com> gcc/ada/ * sem_ch3.adb (Complete_Private_Subtype): Propagate attributes Has_Attributes and Predicate_Function to the cloned subtype. From-SVN: r275795
2019-09-17[Ada] Fix ineffective -gnatyN for separate compilation unitsEric Botcazou2-2/+8
This fixes a recent regression introduced in the machinery giving style warnings: the -gnatyN switch no longer cancels an earlier -gnaty switch for separate compilation units. Running this command: gcc -c slib.adb -gnatyaAbcefhiIklmM25OnprStux -gnatyN On the following sources: package Slib is procedure I_Am_Short; end Slib; with Ada.Text_IO; use Ada.Text_IO; package body Slib is -- have a long line here as well. procedure I_Am_Short is separate; end Slib; separate (Slib) procedure I_Am_Short is begin Put_Line ("......................................................."); end I_Am_Short; Should execute silently. 2019-09-17 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * sem.adb (Do_Analyze): Save Style_Check_Max_Line_Length on entry and restore it on exit instead of recomputing it. From-SVN: r275794
2019-09-17[Ada] Update the character type comment in exp_dbug.adsTom Tromey2-7/+14
The character type comment in exp_dbug.ads documented the QU and QW encodings, but did not document the plain "Qc" encoding, where 'c' is the character itself. This patch updates the comment to follow the implementation. 2019-09-17 Tom Tromey <tromey@adacore.com> gcc/ada/ * exp_dbug.ads: Update character type comment. From-SVN: r275793
2019-09-17[Ada] Minor fixes mostly in comments of runtime arithmetic unitYannick Moy2-6/+27
Multiple comments in functions Double_Divide and Scaled_Divide were incorrect. Now fixed. Also change the expression (if Zhi /= 0 then Ylo * Zhi else 0) to the simpler equivalent (Ylo * Zhi) in Double_Divide. Also add a comment explaining why the implementation of Algorithm D for multiple-precision division from the 2nd Edition of The Art of Computer Programming does not suffer from two bugs discovered on that version. There is no impact on execution, hence no test. 2019-09-17 Yannick Moy <moy@adacore.com> gcc/ada/ * libgnat/s-arit64.adb (Double_Divide): Simplify needlessly complex computation. Fix comments. (Scaled_Divide): Fix comments. Explain why implementation does not suffer from bugs in Algorithm D from 2nd Edition of TAOCP. From-SVN: r275792
2019-09-17[Ada] Raise Constraint_Error in overflow case involving roundingYannick Moy2-0/+13
Function Scaled_Divide in s-arith runtime unit computes the combined multiplication and division of its arguments ((X*Y) / Z). In a very special case where the quotient computed before rounding is 2**64-1, then rounding may lead to undesirable wrap-around, leading to a computed quotient of 0 instead of raising Constraint_Error as expected. This function is only called in the runtime for arithmetic operations involving fixed-point types. Rounding is performed only when the target type is of a decimal fixed-point type, and the attribute 'Round of the type is used to round the result of the arithmetic operation. This fix correctly raises Constraint_Error in this special case. 2019-09-17 Yannick Moy <moy@adacore.com> gcc/ada/ * libgnat/s-arit64.adb (Scaled_Divide): Add protection against undesirable wrap-around. gcc/testsuite/ * gnat.dg/multfixed.adb: New testcase. From-SVN: r275791
2019-09-17[Ada] Fix possible suppressed overflows in arithmetic run-timeYannick Moy2-2/+11
Function Double_Divide computes the division of its parameters (X / (Y*Z)) in a way that avoids overflows on signed integers, except in two specific cases, when X = -2**63, abs(Y) = abs(Z) = 1 (leading to an overflow in -To_Int(Qu)) and when X = -2**63 and Y*Z is large enough that Qu=0 and so the remainder Ru=2**63 (leading to an overflow in -To_Int(Ru)), for example with Y = Z = 2**32-1. This fix avoids the overflow by applying "-" on the unsigned value before the conversion to signed integer. The issue cannot manifest as an overflow check failure in our runtime, as overflow checks are suppressed by using pragma Suppress at the start of the file. Assuming a machine implements wraparound semantics here, the result was correct even with the suppressed overflow. As a result, there can be no test showing the difference. 2019-09-17 Yannick Moy <moy@adacore.com> gcc/ada/ * libgnat/s-arit64.adb (Double_Divide): Fix two possible overflows. From-SVN: r275790
2019-09-17[Ada] Force even timestamp in Windows ALI filesDmitriy Anisimkov4-2/+27
Old versions forced even file timestamp in Windows in GNAT.OS_Lib.GM_Split implementation. We removed this time distortion in GNAT.OS_Lib.GM_Split a few commits. But gprbuild became unnecessary recompiling the sources in 50% cases, when the source has odd file timestamp. This commit is restoring the compatibility between new gprbuild and old GNAT compilers. 2019-09-17 Dmitriy Anisimkov <anisimko@adacore.com> gcc/ada/ * make_util.ads (On_Windows): Move... * osint.ads (On_Windows): There. * osint.adb (OS_Time_To_GNAT_Time): If odd incremented on Windows before conversion to Time_Stamp_Type. From-SVN: r275789
2019-09-17[Ada] GNATprove: avoid crash on illegal borrow during package elaborationYannick Moy2-4/+13
In GNATprove, a borrow during package elaboration is illegal, but a crash could be issued when analyzing the corresponding declaration. Now avoid analyzing the declaration in that case. There is no test as this does not impact compilation. 2019-09-17 Yannick Moy <moy@adacore.com> gcc/ada/ * sem_spark.adb (Check_Declaration): Do not check the assignment from an illegal declaration. From-SVN: r275788
2019-09-17[Ada] Clarify documentation for Stack_UsageBob Duff4-3/+21
Clarify the documentation for Stack_Usage (both comments in the code, and user documentation) to note that tools like Valgrind won't work. 2019-09-17 Bob Duff <duff@adacore.com> gcc/ada/ * doc/gnat_ugn/gnat_and_program_execution.rst: Clarify documentation. * gnat_ugn.texi: Regenerate. * libgnat/s-stausa.ads: Clarify comments. From-SVN: r275787
2019-09-17[Ada] Don't accept illegal (e.g., Integer'(null)) generic actualsSteve Baird3-3/+21
Sem_Util.Wrong_Type usually emits an error message, but in some cases it does not. The code which prevents emitting an error message was going too far in some cases, causing illegal constructs to be accepted. For example, a qualified expression such as Integer'(null) might be passed in as an actual parameter in an instantiation of a generic and generate no error message. Running this command: gcc -c inst.ads On the following sources: package Inst is type Ptr is new Integer; generic type TElement is private; NonDefini : TElement; package ArbMgr is end ArbMgr; package Pack is new ArbMgr (Ptr, Ptr'(null)); procedure Dummy; end Inst; Should produce the following output: inst.ads:10:42: expected type "Ptr" defined at line 2 inst.ads:10:42: found an access type compilation abandoned due to previous error 2019-09-17 Steve Baird <baird@adacore.com> gcc/ada/ * sem_util.adb (Wrong_Type): In deciding to suppress a message, it is not enough for In_Instance to be True; in addition, In_Generic_Actual (Expr) must be False. * sem_type.adb (In_Generic_Actual): Fix bug where traversal of parents skips every other node. From-SVN: r275786
2019-09-17[Ada] Support chained calls to traversal functions in SPARKClaire Dross2-7/+63
This change only affects the SPARK toolset. In the part of semantic analysis enforcing ownership rules for SPARK, it corrects a crash in analysis of a declaration of a local borrower whose definition is a chain of several calls to traversal functions. 2019-09-17 Claire Dross <dross@adacore.com> gcc/ada/ * sem_spark.adb (Get_Observed_Or_Borrowed_Expr): If the definition of a local borrower contains calls to traversal functions, the borrowed expression is the first parameter of the first traversal function call in the definition. From-SVN: r275785
2019-09-17[Ada] Remove section on pragma No_Run_TimeEd Falis4-731/+703
This pragma has been long obsolescent and confuses users. 2019-09-17 Ed Falis <falis@adacore.com> gcc/ada/ * doc/gnat_rm/implementation_defined_pragmas.rst: Remove section. * gnat_rm.texi, gnat_ugn.texi: Regenerate. From-SVN: r275784
2019-09-17[Ada] Close file descriptors allocated for tty only onceVadim Godunko4-9/+53
2019-09-17 Vadim Godunko <godunko@adacore.com> gcc/ada/ * libgnat/g-exptty.ads (Close_Input): New subprogram. * libgnat/g-exptty.adb (Close_Input): New subprogram. (Close): Move close of TTY to Close_Input. * terminals.c (__gnat_close_tty): Set file descriptors to invalid value after close. From-SVN: r275783
2019-09-17[Ada] GNAT.Expect (Expect_Internal): Try to call 'poll' few timesVadim Godunko2-2/+16
'poll' returns -1 in case of any error (including interruption by a signal), so call need to be repeated few times to avoid false failures. 2019-09-17 Vadim Godunko <godunko@adacore.com> gcc/ada/ * libgnat/g-expect.adb (Expect_Internal): Try to call 'poll' few times. From-SVN: r275782
2019-09-17[Ada] Avoid to close irrelevant file descriptorsVadim Godunko4-14/+46
'Close' subprogram of GNAT.Expect can close irrelevant file descriptors when 'Expect' was terminated by Process_Died exception and any file open operations was done before call to 'Close'. 2019-09-17 Vadim Godunko <godunko@adacore.com> gcc/ada/ * libgnat/g-expect.ads, libgnat/g-expect.adb (Close_Input): New subprogram. (Get_Command_Output): Call Close_Input to close input stream. (Expect_Internal): Likewise. (Close): Likewise. * libgnat/g-exptty.adb (Close): Likewise. gcc/testsuite/ * gnat.dg/expect3.adb: New testcase. From-SVN: r275781
2019-09-17[Ada] A new utility routine for detecting attribute 'OldPiotr Trojanek3-0/+18
Add a utility routine for detecting attribute 'Old. It will be immediately reused in the GNATprove backend. 2019-09-17 Piotr Trojanek <trojanek@adacore.com> gcc/ada/ * sem_util.ads, sem_util.adb (Is_Attribute_Old): New utility routine. From-SVN: r275780
2019-09-17[Ada] Do not inline dispatching operations in GNATprove modeYannick Moy2-0/+11
In GNATprove, local subprograms without contracts are candidates for inlining, so that they are only analyzed in the context of their calls. This does not apply to dispatching operations, which may be called through dispatching, in an unknown calling context. Hence such operations should not be considered as candidates for inlining. There is no test as this has no effect on compilation. 2019-09-17 Yannick Moy <moy@adacore.com> gcc/ada/ * inline.adb (Can_Be_Inlined_In_GNATprove_Mode): Add handling for dispatching operations. From-SVN: r275779
2019-09-17[Ada] In a generic use Presanalyze_Spec_Expression on PredicatesEd Schonberg2-1/+7
When verifying that the meaning of an aspect has not changed between the freeze point of the entity and the end of the declarations, we analkyze a copy of the expression to verify its conformance to previous analysis. If the expression contains overloaded references, these have to be resolved, which is not done if the expression is only preanalyzed. This applies in particular to expressions in predicates. 2019-09-17 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * sem_ch13.adb (Check_Aspect_At_End_Of_Declarations): In a generic context, for a Predicate aspect, use Preanalyze_Spec_Expression to verify conformance. gcc/testsuite/ * gnat.dg/predicate13.adb, gnat.dg/predicate13.ads: New testcase. From-SVN: r275778
2019-09-17[Ada] Missing tagged type decoration in corresponding record subtypesJavier Miranda2-0/+6
The frontend silently skips propagating attribute Is_Tagged_Type to the constrained corresponding record subtype associated with a protected type or task type with discriminants. This change does not affect the functionality of the compiler; it leaves more clean the decoration of internal entities. 2019-09-17 Javier Miranda <miranda@adacore.com> gcc/ada/ * sem_ch3.adb (Constrain_Corresponding_Record): Propagate attribute Is_Tagged_Type. From-SVN: r275777
2019-09-17[Ada] Ada 2020: Raise expressions in limited contexts (AI12-0172)Javier Miranda5-4/+48
This patch adds support for the use of raise expressions in more limited contexts (as described in the Ada Isssue AI12-0172). 2019-09-17 Javier Miranda <miranda@adacore.com> gcc/ada/ * exp_ch3.adb (Build_Record_Init_Proc): Do not generate code to adjust the tag component when the record is initialized with a raise expression. * sem_aggr.adb (Valid_Limited_Ancestor): Return True for N_Raise_Expression nodes. (Valid_Ancestor_Type): Return True for raise expressions. * sem_ch3.adb (Analyze_Component_Declaration): Do not report an error when a component is initialized with a raise expression. * sem_ch4.adb (Analyze_Qualified_Expression): Do not report an error when the aggregate has a raise expression. gcc/testsuite/ * gnat.dg/limited4.adb: New testcase. From-SVN: r275776
2019-09-17[Ada] Ignore missing ALI files in GNATprove modePiotr Trojanek4-15/+20
This change only affects GNATprove backend, where it avoids spurious errors on missing ALI files for units indirectly withed from the current unit and processed as part of a different .gpr project. No test provided, because only GNATprove is affected. 2019-09-17 Piotr Trojanek <trojanek@adacore.com> gcc/ada/ * ali.ads: Fix casing in comment. * ali-util.ads, ali-util.adb (Read_Withed_ALIs): Remove Ignore_Errors parameter; it was only set to non-default value of True when running in GNATprove_Mode and wrongly reset to False when calling this routine recursively. Now in GNATprove mode we want it to be always True, so in fact it is equivalent to GNATProve_Mode flag itself (which was already used in this routine). From-SVN: r275775
2019-09-17[Ada] PR ada/91268 Do not redefine macrosArnaud Charlet2-0/+10
This should fix PR ada/91268 by only defining macros if not already done. 2019-09-17 Arnaud Charlet <charlet@adacore.com> gcc/ada/ * adaint.c (_REENTRANT, _THREAD_SAFE): Only define if needed. From-SVN: r275774
2019-09-17[Ada] Refine change for bit-packed slicesArnaud Charlet2-2/+11
We use Long_Long_Integer'Size / 2 instead of 4 * 8 to support specifying a target configuration file where the largest integer is 32 bits instead of 64. 2019-09-17 Arnaud Charlet <charlet@adacore.com> gcc/ada/ * libgnat/s-bitfie.ads (Val_Bits, Val_Bytes): Define from Long_Long_Integer'Size. From-SVN: r275773
2019-09-17[Ada] Adding assertions on extra formals for BIP function callsJavier Miranda4-6/+76
This patch adds assertions to ensure that the frontend passes to the backend the right number of extra parameters required for build in place function calls. No functional change. 2019-09-17 Javier Miranda <miranda@adacore.com> gcc/ada/ * exp_ch6.ads (Needs_BIP_Task_Actuals): New subprogram. * exp_ch6.adb (Add_Task_Actuals_To_Build_In_Place_Call): Code cleanup. (Check_Number_Of_Actuals): New subprogram. (Make_Build_In_Place_Call_In_Allocator): Adding assertion. (Make_Build_In_Place_Call_In_Anonymous_Context): Adding assertion. (Make_Build_In_Place_Call_In_Assignment): Adding assertion. (Make_Build_In_Place_Call_In_Object_Declaration): Code cleanup plus assertion addition. (Needs_BIP_Task_Actuals): New subprogram. * sem_ch6.adb (Create_Extra_Formals): Rely on Needs_BIP_Task_Actuals() to check if the master of the tasks to be created, and the caller's activation chain formals are needed. From-SVN: r275772
2019-09-17[Ada] Avoid touching potentially nonexistent memoryBob Duff3-39/+158
...in cases where the Val_2 might cross a page boundary, and the second page is now known to exist. Copy_Bitfield is still disabled in the compiler: no test possible. 2019-09-17 Bob Duff <duff@adacore.com> gcc/ada/ * libgnat/s-bituti.adb (Get_Val_2, Set_Val_2): Use new routines for getting and setting a Val_2, avoiding touching the second half when that half might not exist. * exp_ch5.adb (Expand_Assign_Array_Loop_Or_Bitfield): Correct tests for potential volatile or independent components. In particular, do not call Prefix unless we know it's a slice. From-SVN: r275771
2019-09-17[Ada] Support for local unix sockets in GNAT.Sockets APIDmitriy Anisimkov7-91/+252
Sock_Addr_Type has Family_Unix variant now. This variant can be created with function Unix_Local_Addr call. And this variant is working in GNAT.Socket routines where it is appropriate. 2019-09-17 Dmitriy Anisimkov <anisimko@adacore.com> gcc/ada/ * gsocket.h: Include sys/un.h. * s-oscons-tmplt.c (AF_UNIX): New constant generation. (SIZEOF_sockaddr_un): Idem. * libgnat/g-socket.ads (Family_Type): New value Family_Unix added. (Family_Inet_4_6): New subtype only for network families. (Sock_Addr_Type): Add Unbounded_String field for Family_Unix variant. (Unix_Socket_Address): Create Sock_Addr_Type from socket pathname. (Network_Socket_Address): Create Sock_Addr_Type from Inet_Addr_Type and Port_Type parameters. * libgnat/g-socket.adb: Support local unix address in socket routines. (Get_Address_Info): Disable warning about Result may be referenced before it has a value. Remove duplicated code to exit from Look_For_Supported. * libgnat/g-sothco.ads (Unix_Name_Length): New constant defining maximum number of characters in local socket address path. (Sockaddr): Add variant for Family_Unix address family. Move Sin_Port and Sin_Family to Family_Inet section. Add Sin6_Port and Sin6_Family to Family_Inet6 section. (Set_Address): Add out parameter Length to return valuable Sockaddr data length. (Get_Address): Add input parameter Length to set valuable Sockaddr data length. * libgnat/g-sothco.adb: Support local unix address in socket routines. From-SVN: r275770
2019-09-17[Ada] Fix wrong value of 'Size for slices of bit-packed arraysEric Botcazou3-16/+35
This fixes a long-standing issue in the compiler which would return a wrong value for the Size attribute applied to slices of bit-packed arrays whose size is not a multiple of the storage unit. The problem is that the computation was done in the code generator after the bit-packed array had been internally rewritten into an array of bytes, so the Size was always rounded up to the next byte. The computation is now rewritten into the product of the Length and Compnent_Size attribute of the slices before being sent to the code generator. 2019-09-17 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * exp_attr.adb (Expand_Size_Attribute): Chain the special cases on the back-end path and rewrite the attribute appled to slices of bit-packed arrays into the product of the Length and the Compoent_Size attributes of the slices. * exp_ch5.adb (Expand_Assign_Array_Bitfield): Use Size attribute directly to compute the bitfield's size. gcc/testsuite/ * gnat.dg/pack25.adb: New testcase. From-SVN: r275769
2019-09-17[Ada] Refine conditions for calling Copy_BitfieldBob Duff3-30/+53
Avoid calling Copy_Bitfield if there are volatile or independent components that might be read or written. The test is conservative. 2019-09-17 Bob Duff <duff@adacore.com> gcc/ada/ * exp_ch5.adb (Expand_Assign_Array_Loop_Or_Bitfield): Add tests for potential volatile or independent components. * libgnat/s-bituti.adb (Copy_Small_Bitfield, Copy_Large_Bitfield): Move declarations to more appropriate place. From-SVN: r275768
2019-09-13gnatmake: Accept the `--sysroot=' GCC driver optionMaciej W. Rozycki2-1/+8
According to `gnatmake' documentation: "Any uppercase or multi-character switch that is not a 'gnatmake' switch is passed to 'gcc' (e.g., '-O', '-gnato,' etc.)" however the `--sysroot=' switch is actually rejected: gnatmake: invalid switch: --sysroot=... likely because it is one of the very few GCC driver options that have a leading double dash and therefore we don't have a blanket fall-through for such switches that would satisfy what our documentation claims. The option is actually shared between the compiler and the linker, so pass the switch to both build stages if requested, removing GNAT testsuite issues like: gnatmake: invalid switch: --sysroot=.../sysroot compiler exited with status 1 Executing on host: .../gcc/gnatclean -c -q -n ./abstract_with_anonymous_result (timeout = 300) spawn -ignore SIGHUP .../gcc/gnatclean -c -q -n ./abstract_with_anonymous_result PASS: gnat.dg/abstract_with_anonymous_result.adb (test for excess errors) UNRESOLVED: gnat.dg/abstract_with_anonymous_result.adb compilation failed to produce executable in a test environment where `--with-build-sysroot=.../sysroot' has been used to build a cross-compiler. Passing to the compilation stage only would lead to errors like: .../bin/riscv64-linux-gnu-ld: cannot find crt1.o: No such file or directory .../bin/riscv64-linux-gnu-ld: cannot find -lc collect2: error: ld returned 1 exit status gnatlink: error when calling .../gcc/xgcc gnatmake: *** link failed. compiler exited with status 1 Executing on host: .../gcc/gnatclean -c -q -n ./abstract_with_anonymous_result (timeout = 300) spawn -ignore SIGHUP .../gcc/gnatclean -c -q -n ./abstract_with_anonymous_result ./abstract_with_anonymous_result.ali ./abstract_with_anonymous_result.o FAIL: gnat.dg/abstract_with_anonymous_result.adb (test for excess errors) Excess errors: .../bin/riscv64-linux-gnu-ld: cannot find crt1.o: No such file or directory .../bin/riscv64-linux-gnu-ld: cannot find -lc gnatlink: error when calling .../gcc/xgcc UNRESOLVED: gnat.dg/abstract_with_anonymous_result.adb compilation failed to produce executable instead. gcc/ada/ * make.adb (Scan_Make_Arg): Also accept `--sysroot=' for the compiler and the linker. From-SVN: r275702
2019-08-30decl.c (maybe_saturate_size): New function.Eric Botcazou3-6/+28
* 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 Botcazou4-20/+32
* 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 Botcazou2-2/+13
* gcc-interface/trans.c (gnat_to_gnu): Do not set the location on an expression used for a tag. From-SVN: r275197
2019-08-30gigi.h (aggregate_type_contains_array_p): Declare.Eric Botcazou4-63/+70
* gcc-interface/gigi.h (aggregate_type_contains_array_p): Declare. * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Record_Type>: For an extension, test Has_Record_Rep_Clause instead of Has_Specified_Layout. (adjust_packed): Return 0 if the type of the field is an aggregate type that contains (or is) a self-referential array. (type_has_variable_size): Delete. * gcc-interface/utils.c (inish_record_type): Constify a variable. (aggregate_type_contains_array_p): Add parameter SELF_REFERENTIAL. <RECORD_TYPE>: Pass it in the recursive call. <ARRAY_TYPE>: If it is true, return true only if the array type is self-referential. (create_field_decl): Streamline the setting of the alignment on the field. Pass false to aggregate_type_contains_array_p. From-SVN: r275196
2019-08-30trans.c (lvalue_required_p): Adjust GNU_TYPE in the recursive call.Eric Botcazou2-4/+12
* 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-30utils.c (build_template): Deal with parameters passed by pointer to ↵Eric Botcazou2-13/+21
component of multi-dimensional arrays. * gcc-interface/utils.c (build_template): Deal with parameters passed by pointer to component of multi-dimensional arrays. From-SVN: r275190
2019-08-30decl.c (annotate_value): Inline the call also if List_Representation_Info is ↵Eric Botcazou2-1/+6
greater than 3. * gcc-interface/decl.c (annotate_value) <CALL_EXPR>: Inline the call also if List_Representation_Info is greater than 3. From-SVN: r275188
2019-08-30* gcc-interface/trans.c (Attribute_to_gnu) <Attr_Size>: Add assertion.Eric Botcazou2-0/+7
From-SVN: r275187
2019-08-30gigi.h (gigi_checking_assert): New macro.Eric Botcazou4-146/+83
* 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-23re PR middle-end/91283 (gcc.dg/torture/c99-contract-1.c FAILs)Jakub Jelinek2-2/+8
PR middle-end/91283 * common.opt (fexcess-precision=): Add Optimization flag. Use flag_excess_precision variable instead of flag_excess_precision_cmdline. * flags.h (class target_flag_state): Remove x_flag_excess_precision member. (flag_excess_precision): Don't define. * langhooks.c (lhd_post_options): Set flag_excess_precision instead of flag_excess_precision_cmdline. Remove comment. * opts.c (set_fast_math_flags): Use frontend_set_flag_excess_precision and x_flag_excess_precision instead of frontend_set_flag_excess_precision_cmdline and x_flag_excess_precision_cmdline. (fast_math_flags_set_p): Use x_flag_excess_precision instead of x_flag_excess_precision_cmdline. * toplev.c (init_excess_precision): Remove. (lang_dependent_init_target): Don't call it. ada/ * gcc-interface/misc.c (gnat_post_options): Set flag_excess_precision instead of flag_excess_precision_cmdline. brig/ * brig-lang.c (brig_langhook_post_options): Set flag_excess_precision instead of flag_excess_precision_cmdline. c-family/ * c-common.c (c_ts18661_flt_eval_method): Use flag_excess_precision instead of flag_excess_precision_cmdline. * c-cppbuiltin.c (c_cpp_flt_eval_method_iec_559): Likewise. * c-opts.c (c_common_post_options): Likewise. d/ * d-lang.cc (d_post_options): Set flag_excess_precision instead of flag_excess_precision_cmdline. fortran/ * options.c (gfc_post_options): Set flag_excess_precision instead of flag_excess_precision_cmdline. Remove comment. go/ * go-lang.c (go_langhook_post_options): Set flag_excess_precision instead of flag_excess_precision_cmdline. lto/ * lto-lang.c (lto_post_options): Set flag_excess_precision instead of flag_excess_precision_cmdline. Remove comment. From-SVN: r274850
2019-08-21[Ada] Improve detection of end of the process by GNAT.ExpectVadim Godunko2-5/+16
'read' system call may be interrupted by signal with 'errno' is set to EINTER. In this case, re-try a few times. 2019-08-21 Vadim Godunko <godunko@adacore.com> gcc/ada/ * libgnat/g-expect.adb (Expect_Internal): Attempt to read several times when 'read' returns non-positive. From-SVN: r274791
2019-08-21[Ada] Minor refactorings/reformattingsPiotr Trojanek6-19/+25
2019-08-21 Piotr Trojanek <trojanek@adacore.com> gcc/ada/ * einfo.adb (Is_Discriminal): Remove extra parens. (Is_Constant_Object): Simplify by reusing Ekind_In. (Is_Prival): Remove extra parens. * checks.adb, exp_ch4.adb, sem_ch3.adb, sem_spark.adb: Minor reformattings. From-SVN: r274790
2019-08-21[Ada] Allow for of iteration on formal vectorsClaire Dross2-1/+54
2019-08-21 Claire Dross <dross@adacore.com> gcc/ada/ * libgnat/a-cofove.ads (Vector): Add an Iterable aspect to allow iteration. (Iter_First, Iter_Next): Primitives used for iteration. From-SVN: r274789
2019-08-21[Ada] More precise propagation of Size attribute in generic instancesYannick Moy2-0/+13
GNATprove analyzer for SPARK code depends on the frontend to accurately propagate the known value of Size attribute. This was not done for formal type parameters in generic instantiations. Now fixed. There is no impact on compilation. 2019-08-21 Yannick Moy <moy@adacore.com> gcc/ada/ * sem_ch3.adb (Analyze_Subtype_Declaration): Inherit RM_Size field for formal type parameters in generic instantiations. From-SVN: r274788
2019-08-21[Ada] Update references to the SPARK RMYannick Moy2-6/+10
2019-08-21 Yannick Moy <moy@adacore.com> gcc/ada/ * sem_spark.adb: Update references to the SPARK RM. From-SVN: r274787
2019-08-21[Ada] More complete information level for -gnatR4 outputEric Botcazou2-16/+36
This instructs -gnatR4 to also list the Etype of components in user-declared record types if it is compiler-generated, for example in: package P3 is type idx is range 1 .. 100; type Arr is array (Idx range <>) of Character; type Rec is record C : Arr (1 .. 5); end record; end P3; 2019-08-21 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * repinfo.adb (List_Array_Info): In -gnatR4 mode, set the relevant flag on the component type here instead of... (List_Object_Info): Likewise for the object type. (List_Entities): ...here. In -gnatR4 mode, recurse into entities local to a record type. (List_Component_Layout): In -gnatR4 mode, mark the type as relevant. From-SVN: r274786
2019-08-21[Ada] Add the System.Bitfield_Utils runtime unitBob Duff7-3/+686
2019-08-21 Bob Duff <duff@adacore.com> gcc/ada/ * Makefile.rtl (GNATRTL_NONTASKING_OBJS): Add s-bitutil.o and s-biutin.o. * exp_ch5.adb (Expand_Assign_Array_Bitfield): New function to generate a call to Copy_Bitfield. This is disabled for now. (Expand_Assign_Array_Loop_Or_Bitfield): New function to decide whether to call Expand_Assign_Array_Bitfield. (Expand_Assign_Array): Call Expand_Assign_Array_Loop_Or_Bitfield instead of Expand_Assign_Array_Loop. * libgnat/s-bitfie.ads, libgnat/s-bituti.adb, libgnat/s-bituti.ads: New units. * rtsfind.ads: Add enum literals for accessing Copy_Bitfield. From-SVN: r274785
2019-08-21[Ada] Bindo.Graphs: Minor typo fixesPiotr Trojanek3-2/+8
2019-08-21 Piotr Trojanek <trojanek@adacore.com> gcc/ada/ * bindo-graphs.ads (Iterate_Edges_To_Successors): Fix typo in pragma Inline. * bindo-graphs.adb (Delete_Edge): Fix layout in parameter list. From-SVN: r274784
2019-08-21[Ada] Undefined master in task with limited class-wide aliased entry formalGary Dismukes2-1/+20
In the case of a task declaring an entry with an aliased formal parameter of a limited class-wide type, the front end was creating a master object (_master) for the access type generated for such an entry formal inside the task specification, even though such access types don't need an associated master. The master object wasn't being copied into the procedure expanded for the task body, but a renaming for the master appeared in the statements of the task body, and the LLVM back end rejects this since the master object doesn't appear in the expanded task procedure (for some reason, gigi doesn't complain). This is fixed by suppressing the creation of the master object in the case where the access-to-limited-class-wide access type is the type of a component in an entry's parameter block. This is similar to the suppression done for the master object in other cases, where the access type designates a type explicitly containing tasks (though the suppression involves testing Comes_From_Source in that case). No simple test (and this only affects the LLVM-based compiler). 2019-08-21 Gary Dismukes <dismukes@adacore.com> gcc/ada/ * exp_ch3.adb (Build_Master): Suppress call to Build_Class_Wide_Master in the case where the access-to-limited-class-wide type was created for a component in an entry's formal parameter block (Is_Parameter_Block_Component_Type), to prevent a master from being created for such access types generated by the front end in a task spec for entry formals in a parameter block. Add a ??? about whether this suppression should be done more generally (such as by using Comes_From_Source). From-SVN: r274783