aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/libgnat
AgeCommit message (Collapse)AuthorFilesLines
7 daysRevert "Ada: Add System.C_Time and GNAT.C_Time units to libgnat"Eric Botcazou24-438/+956
This reverts commit 41974d6ed349507ca1532629851b7b5d74f44abc.
7 daysAda: Add System.C_Time and GNAT.C_Time units to libgnatNicolas Boulenguez24-956/+438
The first unit provides the time_t, timeval and timespec types corresponding to the C types defined by the OS, as well as various conversion functions. The second unit is a mere renaming of the first under the GNAT hierarchy. This removes C time types and conversions under System, and from bodies and private parts under GNAT, while keeping visible types and conversions under GNAT as Obsolescent. [changelog] PR ada/114065 * Makefile.rtl (GNATRTL_NONTASKING_OBJS): Add g-c_time$(objext) and s-c_time$(objext). (Aarch64/Android): Do not use s-osinte__android.adb. (SPARC/Solaris): Do not use s-osprim__solaris.adb. (x86/Solaris): Likewise. (LynxOS178): Do not use s-parame__posix2008.ads. (RTEMS): Likewise. (x32/Linux): Likewise, as well as s-linux__x32.ads. Replace s-osprim__x32.adb with s-osprim__posix.adb. (LIBGNAT_OBJS): Remove cal.o. * cal.c: Delete. * doc/gnat_rm/the_gnat_library.rst (GNAT.C_Time): New entry. (GNAT.Calendar): Do not mention the obsolete conversion functions. * impunit.adb (Non_Imp_File_Names_95): Add g-c_time. * libgnarl/a-exetim__posix.adb: Add with clause for System.C_Time (Clock): Use type and functions from System.C_Time. * libgnarl/s-linux.ads: Remove with clause for System.Parameters. Remove declarations of C time types. * libgnarl/s-linux__alpha.ads: Likewise. * libgnarl/s-linux__android-aarch64.ads: Likewise. * libgnarl/s-linux__android-arm.ads: Likewise. * libgnarl/s-linux__hppa.ads: Likewise. * libgnarl/s-linux__loongarch.ads: Likewise. * libgnarl/s-linux__mips.ads: Likewise. * libgnarl/s-linux__riscv.ads: Likewise. * libgnarl/s-linux__sparc.ads: Likewise. * libgnarl/s-osinte__aix.ads: Likewise. * libgnarl/s-osinte__android.ads: Likewise. * libgnarl/s-osinte__cheribsd.ads: Likewise. * libgnarl/s-osinte__darwin.ads: Likewise. * libgnarl/s-osinte__dragonfly.ads: Likewise. * libgnarl/s-osinte__freebsd.ads: Likewise. * libgnarl/s-osinte__gnu.ads: Likewise. * libgnarl/s-osinte__hpux.ads: Likewise. * libgnarl/s-osinte__kfreebsd-gnu.ads: Likewise. * libgnarl/s-osinte__linux.ads: Likewise. * libgnarl/s-osinte__lynxos178e.ads: Likewise. * libgnarl/s-osinte__qnx.ads: Likewise. * libgnarl/s-osinte__rtems.ads: Likewise. * libgnarl/s-osinte__solaris.ads: Likewise. * libgnarl/s-osinte__vxworks.ads: Likewise. * libgnarl/s-qnx.ads: Likewise. * libgnarl/s-linux__x32.ads: Delete. * libgnarl/s-osinte__darwin.adb (To_Duration): Remove. (To_Timespec): Likewise. * libgnarl/s-osinte__aix.adb: Likewise. * libgnarl/s-osinte__dragonfly.adb: Likewise. * libgnarl/s-osinte__freebsd.adb: Likewise. * libgnarl/s-osinte__gnu.adb: Likewise. * libgnarl/s-osinte__lynxos178.adb: Likewise. * libgnarl/s-osinte__posix.adb: Likewise. * libgnarl/s-osinte__qnx.adb: Likewise. * libgnarl/s-osinte__rtems.adb: Likewise. * libgnarl/s-osinte__solaris.adb: Likewise. * libgnarl/s-osinte__vxworks.adb: Likewise. * libgnarl/s-osinte__x32.adb: Likewise. * libgnarl/s-taprop__solaris.adb: Add with clause for System.C_Time. (Monotonic_Clock): Use type and functions from System.C_Time. (RT_Resolution): Likewise. (Timed_Sleep): Likewise. (Timed_Delay): Likewise. * libgnarl/s-taprop__vxworks.adb: Likewise. * libgnarl/s-tpopmo.adb: Likewise. * libgnarl/s-osinte__android.adb: Delete. * libgnat/g-c_time.ads: New file. * libgnat/g-calend.adb: Delegate to System.C_Time. * libgnat/g-calend.ads: Likewise. * libgnat/g-socket.adb: Likewise. * libgnat/g-socthi.adb: Likewise. * libgnat/g-socthi__vxworks.adb: Likewise. * libgnat/g-sothco.ads: Likewise. * libgnat/g-spogwa.adb: Likewise. * libgnat/s-c_time.adb: New file. * libgnat/s-c_time.ads: Likewise. * libgnat/s-optide.adb: Import nanosleep here. * libgnat/s-os_lib.ads (time_t): Remove. (To_Ada): Adjust. (To_C): Likewise. * libgnat/s-os_lib.adb: Likewise. * libgnat/s-osprim__darwin.adb: Delegate to System.C_Time. * libgnat/s-osprim__posix.adb: Likewise. * libgnat/s-osprim__posix2008.adb: Likewise. * libgnat/s-osprim__rtems.adb: Likewise. * libgnat/s-osprim__unix.adb: Likewise. * libgnat/s-osprim__solaris.adb: Delete. * libgnat/s-osprim__x32.adb: Likewise. * libgnat/s-parame.ads (time_t_bits): Remove. * libgnat/s-parame__hpux.ads: Likewise. * libgnat/s-parame__vxworks.ads: Likewise. * libgnat/s-parame__posix2008.ads: Delete. * s-oscons-tmplt.c (SIZEOF_tv_nsec): New constant.
13 daysada: Fix inconsistencies in conversion functions from DurationEric Botcazou3-17/+42
The 3 units Ada.Calendar, GNAT.Calendar and GNAT.Sockets contain conversion functions from the Duration fixed-point type that implement the same idiom but with some inconsistencies: * GNAT.Sockets only handles Timeval_Duration, i.e. positive Duration, and is satisfactory, although a simpler implementation can be written, * GNAT.Calendar mishandles negative Duration values, as well as integral Duration values, * Ada.Calendar mishandles negative Duration values, and rounds nanoseconds instead of truncating them. gcc/ada/ChangeLog: * libgnat/a-calend.adb (To_Struct_Timespec_64): Deal with negative Duration values and truncate the nanoseconds too. * libgnat/g-calend.adb (timeval_to_duration): Unsuppress overflow checks. (duration_to_timeval): Likewise. Deal with negative Duration values as well as integral Duration values. * libgnat/g-socket.adb (To_Timeval): Simplify the implementation.
2025-07-22ada: Additional condition for Capacity discriminant on bounded container ↵Gary Dismukes2-2/+2
aggregates This change test an additional condition as part of the criteria used for deciding whether to generate a call to a container type's Length function (for passing to the Empty function) when determining the size of the object to allocate for a bounded container aggregate with a "for of" iterator. An update is also made to function Empty in Ada.Containers.Bounded_Hash_Maps, adding a default to the formal Capacity, to make it consistent with other bounded containers (and to make it conformant with the Ada RM). gcc/ada/ChangeLog: * libgnat/a-cbhama.ads (Empty): Add missing default to Capacity formal. * libgnat/a-cbhama.adb (Empty): Add missing default to Capacity formal. * exp_aggr.adb (Build_Size_Expr): Test for presence of Capacity discriminant as additional criterion for generating the call to the Length function. Update comments.
2025-07-03Ada: Remove left-overs of front-end exception mechanismEric Botcazou1-1/+0
It was removed from the compiler a few releases ago. gcc/ada/ * gcc-interface/Makefile.in (gnatlib-sjlj): Delete. (gnatlib-zcx): Do not modify Frontend_Exceptions constant. * libgnat/system-linux-loongarch.ads (Frontend_Exceptions): Delete.
2025-07-03ada: Port System.Stack_Usage to CHERIDaniel King2-25/+24
This unit performed integer to address conversions to calculate stack addresses which, on a CHERI target, result in an invalid capability that triggers a capability tag fault when dereferenced during stack filling. This patch updates the unit to preserve addresses (capabilities) during the calculations. The method used to determine the stack base address is also updated to CHERI. The current method tries to get the stack base from the compiler info for the current task. If no info is found, then as a fallback it estimates the base by taking the address of a variable on the stack. This address is then derived to calculate the range of addresses to fill the stack. This fallback does not work on CHERI since taking the 'Address of a stack variable will result in a capability with bounds restricted to that object and attempting to write outside those bounds triggers a capability bounds fault. Instead, we add a new function Get_Stack_Base which, on CHERI, gets the exact stack base from the upper bound of the capability stack pointer (CSP) register. On non-CHERI platforms, Get_Stack_Base returns the stack base from the compiler info, resulting in the same behaviour as before on those platforms. gcc/ada/ChangeLog: * Makefile.rtl (LIBGNAT_TARGET_PAIRS): New unit s-tsgsba__cheri.adb for morello-freebsd. * libgnarl/s-tassta.adb (Get_Stack_Base): New function. * libgnarl/s-tsgsba__cheri.adb: New file for CHERI targets. * libgnarl/s-tsgsba.adb: New default file for non-CHERI targets. * libgnat/s-stausa.adb (Fill_Stack, Compute_Result): Port to CHERI. * libgnat/s-stausa.ads (Initialize_Analyzer, Stack_Analyzer): Port to CHERI.
2025-07-03ada: Fix spurious Constraint_Error raised by 'Value of fixed-point typesEric Botcazou7-51/+10
This happens for very large Smalls with regard to the size of the mantissa, because the prerequisites of the implementation used in this case are not met, although they are documented in the head comment of Integer_To_Fixed. This change documents them at the beginning of the body of System.Value_F and adjusts the compiler interface accordingly. gcc/ada/ChangeLog: * libgnat/s-valuef.adb: Document the prerequisites more precisely. * libgnat/a-tifiio.adb (OK_Get_32): Adjust to the prerequisites. (OK_Get_64): Likewise. * libgnat/a-tifiio__128.adb (OK_Get_32): Likewise. (OK_Get_64): Likewise. (OK_Get_128): Likewise. * libgnat/a-wtfiio.adb (OK_Get_32): Likewise. (OK_Get_64): Likewise. * libgnat/a-wtfiio__128.adb (OK_Get_32): Likewise. (OK_Get_64): Likewise. (OK_Get_128): Likewise. * libgnat/a-ztfiio.adb (OK_Get_32): Likewise. (OK_Get_64): Likewise. * libgnat/a-ztfiio__128.adb (OK_Get_32): Likewise. (OK_Get_64): Likewise. (OK_Get_128): Likewise. * exp_imgv.adb (Expand_Value_Attribute): Adjust the conditions under which the RE_Value_Fixed{32,64,128} routines are called for ordinary fixed-point types.
2025-07-03ada: Remove unnecessary "return;" statementsBob Duff2-2/+2
A "return;" at the end of a procedure is unnecessary and misleading. This patch removes them. gcc/ada/ChangeLog: * checks.adb: Remove unnecessary "return;" statements. * eval_fat.adb: Likewise. * exp_aggr.adb: Likewise. * exp_attr.adb: Likewise. * exp_ch3.adb: Likewise. * exp_ch4.adb: Likewise. * exp_ch5.adb: Likewise. * exp_ch6.adb: Likewise. * exp_unst.adb: Likewise. * krunch.adb: Likewise. * layout.adb: Likewise. * libgnat/s-excdeb.adb: Likewise. * libgnat/s-trasym__dwarf.adb: Likewise. * par-endh.adb: Likewise. * par-tchk.adb: Likewise. * sem.adb: Likewise. * sem_attr.adb: Likewise. * sem_ch6.adb: Likewise. * sem_elim.adb: Likewise. * sem_eval.adb: Likewise. * sfn_scan.adb: Likewise.
2025-07-03ada: Document restriction on array lengthTonu Naks1-0/+11
gcc/ada/ChangeLog: * libgnat/i-cstrin.ads (Value): add documentation
2025-07-03ada: Fix index bounds check in Super_Delete functions and proceduresAleksandra Pasek3-6/+6
gcc/ada/ChangeLog: * libgnat/a-strsup.adb (Super_Delete): Fix index check. * libgnat/a-stwisu.adb (Super_Delete): Likewise. * libgnat/a-stzsup.adb (Super_Delete): Likewise.
2025-07-03ada: Use consistent truncation of 'Value for decimal fixed-point typesEric Botcazou1-2/+2
This uses truncation for all bases instead of for base 10 only. gcc/ada/ChangeLog: * libgnat/s-valued.adb (Integer_to_Decimal): Use truncation for the scaled divide operation performed for bases other than 10.
2025-07-01ada: Restore consistent rounding of 'Value for ordinary fixed-point typesEric Botcazou1-1/+5
This restores the rounding of the first scaled divide operation applied to the extra digits, which yields more consistent results for smalls that are reciprocal of integers. gcc/ada/ChangeLog: * libgnat/s-valuef.adb (Integer_to_Fixed): Restore rounding of the first scaled divide operation.
2025-07-01ada: Disallow underscore before exponentTonu Naks1-2/+6
Underscore is allowed only between digits. The current implementattion was considering 'E' as a digit even if it was not in the range of Base and could denote exponent only. gcc/ada/ChangeLog: * libgnat/s-valuer.adb (Scan_Decimal_Digits, Scan_Integral_Digits): fix condition for rejecting underscore.
2025-07-01ada: Fix couple of issues in System.Value_D.Integer_To_Decimal functionEric Botcazou2-21/+33
The first issue is that the function would wrongly raise Constraint_Error on the edge case where Val = 2**(Int'Size - 1) and Minus is not set. The second issue is that the function takes a long time to deal with huge negative exponents. The change also contains minor consistency fixes for its counterpart that is present in System.Value_F, namely Integer_To_Fixed. gcc/ada/ChangeLog: * libgnat/s-valued.adb (Integer_To_Decimal): Deal specifically with Val = 2**(Int'Size - 1) if Minus is not set. Exit the loops when V saturates to 0 in the case of (huge) negative exponents. Use Base instead of B consistently in unsigned computations. * libgnat/s-valuef.adb (Integer_To_Fixed): Use Base instead of B consistently in unsigned computations.
2025-07-01ada: Reduce the likelihood of overflow in TanhTonu Naks1-5/+8
gcc/ada/ChangeLog: * libgnat/a-ngelfu.adb: conditional computation of X^2
2025-07-01ada: Split the unit System.Case_Utilities into two parts.Steve Baird5-94/+247
The package System.Case_Utilities provides some subprograms that do not make use of the secondary stack and some that do. When compiling in a context where no secondary stack support is provided, this makes the entire package unusable (and similarly for any other package that withs this package). Split the package into two packages named Case_Utilities_NSS and Case_Utilities (NSS is for "no secondary stack"). The first package declares the subprograms that do not need secondary stack support. The second package declares the remaining subprograms, as well as renamings of everything declared in the first part. A client that continues to reference Case_Utilities is largely unaffected by this change. But if we change a client to reference Case_Utilities_NSS instead, that removes an obstacle that would otherwise prevent using that client unit in a no-secondary-stack-support environment. We then make that change to the body of package System.Val_Util. gcc/ada/ChangeLog: * Makefile.rtl: Add entry for new unit's object file. * libgnat/s-casuti.adb: Remove bodies of subprograms that were moved to the new unit. * libgnat/s-casuti.ads: Replace (with renamings) declarations for subprograms that moved to the new unit. * libgnat/s-cautns.adb: Body for new unit (a new source file). * libgnat/s-cautns.ads: Spec for new unit (a new source file). * libgnat/s-valuti.adb: Use the new unit instead of the old one. * gcc-interface/Make-lang.in: Add entries for new unit's object file. * gcc-interface/Makefile.in: Likewise.
2025-07-01ada: Correct comment in s-valuen.adsAleksandra Pasek1-2/+2
gcc/ada/ChangeLog: * libgnat/s-valuen.ads: Correct comment.
2025-07-01ada: Get rid of multiple roundings for 'Value of ordinary fixed-point typesEric Botcazou5-220/+149
They are used to minimize the error after every operation, but they can be eliminated by increasing the precision of the input value, which avoids the unwanted effects of multiple roundings. gcc/ada/ChangeLog: * libgnat/s-valuer.ads (System.Value_R): Remove Round parameter. (Scan_Raw_Real): Replace Extra with Extra2 and adjust the comment. (Value_Raw_Real): Likewise. * libgnat/s-valuer.adb (Round_Extra): Delete. (Scan_Decimal_Digits): Replace Extra with Extra2 and adjust the implementation. (Scan_Integral_Digits): Replace Extra with Extra2 and Extra_Rounded with Extra2_Filled and adjust the implementation. (Scan_Raw_Real): Replace Extra with Extra2 and adjust the implementation. (Value_Raw_Real): Likewise. * libgnat/s-valrea.adb (Impl): Remove actual for Round formal. * libgnat/s-valued.adb (Impl): Likewise. (Integer_to_Decimal): Replace Extra with Extra2 and adjust the implementation. Rename Unsigned_To_Signed to To_Signed. (Scan_Decimal): Replace Extra with Extra2 and adjust the implementation. (Value_Decimal): Likewise. * libgnat/s-valuef.adb (Impl): Remove actual for Round formal. (Integer_to_Fixed): Replace Extra with Extra2 and adjust the implementation. Rename Unsigned_To_Signed to To_Signed. Only round the last scaled divide operation. (Scan_Fixed): Replace Extra with Extra2 and adjust the implementation. (Value_Fixed): Likewise.
2025-07-01ada: Clarify numeric parsing codeRonan Desplanques1-20/+18
This patch rephrases some code in System.Value_R to make it easier to read. gcc/ada/ChangeLog: * libgnat/s-valuer.adb (Scan_Decimal_Digits, Scan_Integral_Digits): Minor rephrasing.
2025-06-30ada: Fix missing rounding in System.Value_R.Scan_Raw_RealEric Botcazou1-11/+36
The extra digit returned by the function is supposed to be rounded, either by Scan_Integral_Digits or by Scan_Decimal_Digits, but that is not the case when it is the last digit read by Scan_Integral_Digits. The problem is fixed by rounding it in Scan_Decimal_Digits in this case. gcc/ada/ChangeLog: * libgnat/s-valuer.adb (Scan_Decimal_Digits): Also pretend that the precision limit was just reached if it was already reached. (Scan_Integral_Digits): Add Extra_Rounded out parameter, set it to False on entry and to True when Extra is rounded. (Scan_Raw_Real): New Extra_Rounded local variable. Pass it in the calls to Scan_Integral_Digits. If it is True, pass a dummy extra digit to Scan_Decimal_Digits.
2025-06-30ada: Ignore ghost predicate in Ada.Strings.SuperboundedClaire Dross1-4/+5
Add an assertion policy to ignore the ghost predicates in Ada.Strings.Superbounded. gcc/ada/ChangeLog: * libgnat/a-strsup.ads: Ignore Ghost_Predicate in the assertion policy.
2025-06-30ada: Array aggregates of mutably tagged objectsJavier Miranda1-0/+18
When an array of mutably tagged class-wide types is initialized with an array aggregate, the compiler erroneously rejects it reporting that the type of the aggregate cannot be a class-wide type. In addition, Program_Error is not raised at runtime on array type or record type objects when they have mutably tagged abstract class-wide type components that are initialized by default. gcc/ada/ChangeLog: * sem_aggr.adb (Resolve_Record_Aggregate): Adjust the code to handle mutably tagged class-wide types since they don't have discriminants, but all class-wide types are considered to have unknown discriminants. Initialize mutably tagged class-wide type components calling their IP subprogram. * exp_aggr.adb (Gen_Assign): Handle mutably tagged class-wide type components that have an initializing qualified expression, and mutably tagged class-wide components default initialization. (Gen_Loop): Handle mutably tagged class-wide types. (Gen_Assign): ditto. (Build_Record_Aggr_Code): Default initialization of mutably tagged class-wide types is performed by their IP subprogram. * exp_ch3.adb (Init_Component): Generate code to raise Program_Error in the IP subprogram of arrays when the type of their components is a mutably tagged abstract class-wide type. (Build_Init_Procedure): ditto for the init procedure of record types. (Build_Init_Statements): Ensure that the type of the expression initializing a mutably class-wide tagged type component is frozen. (Requires_Init_Proc): Mutably tagged class-wide types require the init-proc since it takes care of their default initialization. * sem_util.adb (Needs_Simple_Initialization): Mutably tagged class-wide types don't require simple initialization. * types.ads (PE_Abstract_Type_Component): New reason for Program_Error. * types.h (PE_Abstract_Type_Component): ditto. * exp_ch11.adb (Get_RT_Exception_Name): Handle new reason for Program_Error. * libgnat/a-except.adb (Rcheck_PE_Abstract_Type_Component): New subprogram.
2025-06-30ada: Remove redundant condition in test of System.Val_Real.Integer_To_RealEric Botcazou2-8/+9
The second condition of the conjunction is redundant with the first. gcc/ada/ChangeLog: * libgnat/s-valrea.adb (Integer_to_Real): Rename to... (Integer_To_Real): ...this. Remove the second condition of the conjunction in the test for the zero value. (Scan_Real): Adjust to above renaming. (Value_Real): Likewise. * libgnat/s-valuer.ads (Scan_Raw_Real): Add note about Val.
2025-06-30ada: Adjust comparisons in if-statements according to coding styleJohannes Kliemann2-3/+3
The Ada coding style requires the use of short circuit forms in if-statements. Use this form consistently for all if-statements. gcc/ada/ChangeLog: * libgnat/s-valuer.adb: Switch missing if-statements to short-circuit form. * libgnat/i-cpoint.adb: Ditto.
2025-06-12ada: Apply tweak for machine-code-based coverageRonan Desplanques1-1/+7
gcc/ada/ChangeLog: * libgnat/s-valuer.adb (Scan_Raw_Real): Apply tweak.
2025-06-12ada: Add Ada RM clause reference in commentRonan Desplanques1-1/+2
gcc/ada/ChangeLog: * libgnat/s-valuer.adb (Scan_Raw_Real): Add RM reference.
2025-06-12ada: Remove subexpression that's always FalseRonan Desplanques1-4/+4
Also improve a few comments in the enclosing subprogram body. gcc/ada/ChangeLog: * libgnat/s-valuer.adb (Scan_Raw_Real): Remove subexpression. Improve surrounding comments.
2025-06-12ada: Fix rounding test with odd basesEric Botcazou1-1/+3
The test as currently written is incorrect for odd bases. gcc/ada/ChangeLog: * libgnat/s-valuer.adb (Round_Extra): Use multiplicative test.
2025-06-12ada: Fix various issues in System.Value_F.Integer_To_Fixed functionEric Botcazou1-10/+27
The first issue is that the function would wrongly raise Constraint_Error on the edge case where Val = 2**(Int'Size - 1) and Minus is not set. The second issue is that some runtimes are compiled with -gnatp and would fail to raise Constraint_Error when the sum of the terms overflows an Int. The third issue is that the function takes a long time to deal with huge negative exponents. gcc/ada/ChangeLog: * libgnat/s-valuef.adb (Integer_To_Fixed): Enable overflow checks. Deal specifically with Val = 2**(Int'Size - 1) if Minus is not set. Exit the loop when V saturates to 0 in the case of (huge) negative exponents.
2025-06-12ada: Adjust alignment calculation for secondary stackJohannes Kliemann2-0/+18
The secondary stack allocator needs to take alignment constraints into account when doing allocations. In the full runtime the secondary stack is allocated in chunks on the heap and can grow dynamically. As it does not grow contiguously the "top" of the stack depends on the size of the allocation. Therefore the alignment of the stack top is not known at allocation time and the padding needed for a particular alignment needs to be calculated conservatively to ensure the allocation fits the requested size after the base address has been aligned. On more restricted platforms the secondary stack is a contiguous block of statically allocated memory. Here the conservative mechanism is not required since the allocations base address is known and the required padding can be calculated right away. The conservative approach also sometimes causes an allocation to be slightly larger than it needs to be. This can be a problem on platforms with limited RAM availability. To avoid this problem modify the calculation of the required padding on these platforms to always exactly fit the required size. gcc/ada/ChangeLog: * libgnat/s-secsta.adb (SS_Allocate): Add comment about conservative alignment padding calculation. * libgnat/s-secsta__cheri.adb (SS_Allocate): Add comment about conservative alignment padding calculation.
2025-06-10ada: Special case for inconsistent pointer in Scan_Raw_UnsignedTonu Naks2-5/+12
gcc/ada/ChangeLog: * libgnat/s-valueu.adb: add explict raise * libgnat/s-valueu.ads: update annotation
2025-06-10ada: Fix inconsistent comment for fixed-point Value attribute implementationEric Botcazou3-9/+9
The comment incorrectly mentions decimal fixed point. gcc/ada/ChangeLog: * libgnat/s-vafi32.ads: Fix head description. * libgnat/s-vafi64.ads: Likewise. * libgnat/s-vafi128.ads: Likewise.
2025-06-10ada: Fix Value_Decimal to raise Constraint_Error on boundary valuesEric Botcazou1-8/+19
Even though the issue is not user-visible, it's a (minor) departure from the specification of the procedure. gcc/ada/ChangeLog: * libgnat/s-valued.adb (Integer_to_Decimal): Add Extra parameter and use its value to call Bad_Value on boundary values. (Scan_Decimal): Adjust call to Integer_to_Decimal. (Value_Decimal): Likewise.
2025-06-09ada: Rename Is_Infinity to Is_Infinity_Or_NaN in System.Double_RealEric Botcazou3-12/+12
The predicate is used to detect corner cases in multiplicative operations and also returns True for NaNs. gcc/ada/ChangeLog: * libgnat/s-dourea.adb (Is_Infinity): Rename to... (Is_Infinity_Or_NaN): ...this. ("*"): Adjust accordingly. ("/"): Likewise. (Sqr): Likewise. * libgnat/s-dorepr.adb (Two_Prod): Likewise. (Two_Sqr): Likewise. * libgnat/s-dorepr__fma.adb (Two_Prod): Likewise.
2025-06-09ada: Fix bindings for CHERI Set_Bounds and Set_Exact_Bounds intrinsics.Daniel King2-4/+26
gcc/ada/ChangeLog: * libgnat/i-cheri.ads (Set_Bounds, Set_Exact_Bounds): Remove wrong intrinsic binding. * libgnat/i-cheri.adb (Set_Bounds, Set_Exact_Bounds): New subprogram bodies.
2025-06-06ada: Deconstruct C header for the SCOs unitPiotr Trojanek1-2/+3
The C version of SCOs unit provided a gigi interface to source code obligations that at some point were generated by the frontend. This functionality has been deconstructed long ago. gcc/ada/ChangeLog: * libgnat/g-dyntab.ads (Instance): Update and extend comment. * scos.ads: Remove comment about the corresponding C header. * scos.h: Remove.
2025-06-05ada: Add explicit null pointer check in C.Strings.UpdateTonu Naks1-0/+5
gcc/ada/ChangeLog: * libgnat/i-cstrin.adb: null pointer check in Update
2025-06-05ada: Remove ghost code and SPARK annotations from runtime unitsArnaud Charlet96-10721/+239
This is a clean up to facilitate maintenance now that these units have been proven. gcc/ada/ChangeLog: * exp_util.adb, rtsfind.adb, rtsfind.ads, sem_prag.adb: Remove references to RO_GH_Big_Integer and Ada_Numerics_Big_Numbers_Big_Integers_Ghost. * libgnat/a-strfix.adb, libgnat/a-strmap.adb, libgnat/a-strsea.adb, libgnat/a-strsup.adb, libgnat/i-c.ads, libgnat/i-c.adb, libgnat/s-aridou.adb, libgnat/s-aridou.ads, libgnat/s-arit128.adb, libgnat/s-arit128.ads, libgnat/s-arit32.adb, libgnat/s-arit32.ads, libgnat/s-arit64.adb, libgnat/s-arit64.ads, libgnat/s-casuti.adb, libgnat/s-exnint.ads, libgnat/s-exnlli.ads, libgnat/s-exnllli.ads, libgnat/s-expint.ads, libgnat/s-explli.ads, libgnat/s-expllli.ads, libgnat/s-explllu.ads, libgnat/s-expllu.ads, libgnat/s-expmod.adb, libgnat/s-expmod.ads, libgnat/s-exponn.adb, libgnat/s-exponn.ads, libgnat/s-expont.adb, libgnat/s-expont.ads, libgnat/s-exponu.adb, libgnat/s-exponu.ads, libgnat/s-imaged.ads, libgnat/s-imaged.adb, libgnat/s-expuns.ads, libgnat/s-imagef.ads, libgnat/s-imagef.adb, libgnat/s-imagei.adb, libgnat/s-imagei.ads, libgnat/s-imageu.adb, libgnat/s-imageu.ads, libgnat/s-imgboo.adb, libgnat/s-imde128.ads, libgnat/s-imde32.ads, libgnat/s-imde64.ads, libgnat/s-imfi128.ads, libgnat/s-imfi32.ads, libgnat/s-imfi64.ads, libgnat/s-imgboo.ads, libgnat/s-imgint.ads, libgnat/s-imglli.ads, libgnat/s-imgllli.ads, libgnat/s-imglllu.ads, libgnat/s-imgllu.ads, libgnat/s-imguns.ads, libgnat/s-valboo.adb, libgnat/s-valboo.ads, libgnat/s-valint.ads, libgnat/s-vallli.ads, libgnat/s-valllli.ads, libgnat/s-vallllu.ads, libgnat/s-valllu.ads, libgnat/s-valuns.ads, libgnat/s-valuti.adb, libgnat/s-valuti.ads, libgnat/s-valuei.adb, libgnat/s-valuei.ads, libgnat/s-valueu.ads, libgnat/s-valueu.adb, libgnat/s-veboop.adb, libgnat/s-veboop.ads, libgnat/s-widint.ads, libgnat/s-widlli.ads, libgnat/s-widllli.ads, libgnat/s-widlllu.ads, libgnat/s-widllu.ads, libgnat/s-widthi.adb, libgnat/s-widthu.adb, libgnat/s-widthu.ads, libgnat/s-widuns.ads: Remove ghost code and SPARK annotations. * libgnat/a-nbnbig.ads, libgnat/a-nbnbig.adb, libgnat/s-spark.ads, libgnat/s-spcuop.adb, libgnat/s-spcuop.ads, libgnat/s-vaispe.adb, libgnat/s-vaispe.ads, libgnat/s-vauspe.adb, libgnat/s-vauspe.ads, libgnat/s-vs_int.ads, libgnat/s-vs_lli.ads, libgnat/s-vs_llu.ads, libgnat/s-vs_uns.ads, libgnat/s-valspe.adb, libgnat/s-valspe.ads, libgnat/s-vsllli.ads, libgnat/s-vslllu.ads: Removed. * Makefile.rtl: Update list of runtime units. * gcc-interface/Make-lang.in: Remove object files.
2025-06-05ada: Activate SPARK_Mode in Ada.Numerics.*_Random specsAndres Toom2-19/+57
gcc/ada/ChangeLog: * libgnat/a-nudira.ads: Activate SPARK mode and add missing basic contracts. Mark the unit as always terminating. * libgnat/a-nuflra.ads: Idem.
2025-06-05ada: Add Ghost aspect to Lo in s-arit32.adbAleksandra Pasek1-1/+2
gcc/ada/ChangeLog: * libgnat/s-arit32.adb: Add Ghost aspect to Lo.
2025-06-05ada: Add missing Ghost aspect to Lemma_Not_In_Range_Big2xx64 in s-aridou.adbAleksandra Pasek1-0/+1
gcc/ada/ChangeLog: * libgnat/s-aridou.adb: Add missing Ghost aspect to Lemma_Not_In_Range_Big2xx64.
2025-06-05ada: Mitigate issue with tracebacksRonan Desplanques1-0/+18
The way we fetch the path to shared objects for traceback generation is not perfectly precise. This patch adds a sanity check to mitigate the consequences of incorrect shared object paths. It's motivated by a real world failure in a GNATSAS test. gcc/ada/ChangeLog: * libgnat/s-trasym__dwarf.adb (Init_Module): Add mitigation.
2025-06-05ada: Add missing Ghost aspect to Lemma_Not_In_Range_Big2xx32 in s-arit32.adbJohannes Kliemann1-0/+1
gcc/ada/ChangeLog: * libgnat/s-arit32.adb (Lemma_Not_In_Range_Big2xx32): Add missing Ghost aspect.
2025-06-05ada: Fix unnecessarily large allocation in New_StringRonan Desplanques1-11/+24
This patches fixes an issue where Interfaces.C.Strings.New_String allocates more memory than necessary when passed a string that contains a NUL character. gcc/ada/ChangeLog: * libgnat/i-cstrin.adb (New_String): Fix size of allocation.
2025-06-05ada: Fix New_Char_Array with empty arraysRonan Desplanques1-27/+35
This patch fixes an integer underflow issue on calls of the form New_Char_Array (X) with X'Last < X'First - 2. That integer underflow caused attempts at allocating impossibly large amount of memory in some cases. gcc/ada/ChangeLog: * libgnat/i-cstrin.adb (Position_Of_Nul): Change specification and adjust body accordingly. (New_Char_Array): Fix size of allocation. (To_Chars_Ptr): Adapt to Position_Of_Nul change.
2025-04-30Fix GNAT build failure for x86/FreeBSDEric Botcazou1-0/+172
gcc/ada/ PR ada/112958 * Makefile.rtl (LIBGNAT_TARGET_PAIRS) [x86 FreeBSD]: Add specific version of s-dorepr.adb. * libgnat/s-dorepr__freebsd.adb: New file.
2025-04-04Ada: Fix thinko in Eigensystem for complex Hermitian matricesEric Botcazou2-61/+66
The implementation solves the eigensystem for a NxN complex Hermitian matrix by first solving it for a 2Nx2N real symmetric matrix and then interpreting the 2Nx1 real vectors as Nx1 complex ones, but the last step does not work. The patch fixes the last step and also performs a small cleanup throughout the implementation, mostly in the commentary and without functional changes. gcc/ada/ * libgnat/a-ngcoar.adb (Eigensystem): Adjust notation and fix the layout of the real symmetric matrix in the main comment. Adjust the layout of the associated code accordingly and correctly turn the 2Nx1 real vectors into Nx1 complex ones. (Eigenvalues): Minor similar tweaks. * libgnat/a-ngrear.adb (Jacobi): Minor tweaks in the main comment. Adjust notation and corresponding parameter names of functions. Fix call to Unit_Matrix routine. Adjust the comment describing the various kinds of iterations to match the implementation.
2025-01-14Ada: add missing support for the S/390 and RISC-V architecturesEric Botcazou2-5/+33
...to the object file reader present in the run-time library. gcc/ada/ PR ada/118459 * libgnat/s-objrea.ads (Object_Arch): Add S390 and RISCV. * libgnat/s-objrea.adb (EM_S390): New named number. (EM_RISCV): Likewise. (ELF_Ops.Initialize): Deal with EM_S390 and EM_RISCV. (Read_Address): Deal with S390 and RISCV.
2025-01-13ada: Remove redundant parentheses inside unary operators (cont.)Piotr Trojanek1-8/+8
GNAT already emits a style warning when redundant parentheses appear inside logical and short-circuit operators. A similar warning will be soon emitted for unary operators as well. This patch removes the redundant parentheses to avoid build errors. gcc/ada/ChangeLog: * libgnat/a-strunb.ads: Remove redundant parentheses inside NOT operators.
2025-01-13ada: Remove redundant parentheses inside unary operators in commentsPiotr Trojanek1-1/+1
GNAT already emits a style warning when redundant parentheses appear inside logical and short-circuit operators. A similar warning will be soon emitted for unary operators as well. This patch removes the redundant parentheses to avoid future build errors. gcc/ada/ChangeLog: * libgnat/s-genbig.adb: Remove redundant parentheses in comments.