GNAT Pro 24 Release Notes ========================= We present here a few highlights of the new features in GNAT Pro 24. You can access the complete list `on the GNAT Pro 24 feature file `_. .. contents:: :local: Vulnerability report -------------------- From 24.2, you can download the GNAT vulnerability report from the Release Download section. It will provide you the list of the CVEs that can impact this product and the corresponding impact analysis describing whether the product is concerned by each CVE. GCC Back-End Update ------------------- The GNAT Pro Ada, C and C++ has now been updated to GCC 12. See `the GCC 12 changes `_ for the corresponding capabilities as well as updates to C and C++. AWS and GNATColl Support for Cross Linux ---------------------------------------- GNATcoll is a library of Ada capabilities, and AWS (Ada Web Server) is a library that allows an Ada application to interact through a web interface and services. They have both been ported to cross linux products, targeting ARM architecture. Jorvik support for light-tasking run-time ----------------------------------------- Jorvik is an extension of the Ravenscar profile introduced in Ada 2022, relaxing some restrictions such as a single entry per queue. The light tasking run-time provided for bare metal and some cross ports now supports Jorvik. For more information see `our Jorvik blogpost `_ Ada Support ----------- String Interpolation ~~~~~~~~~~~~~~~~~~~~ String interpolation allows to easily introduce expressions to be computed directly in a string literal. For example: .. code-block:: Ada procedure Test_Interpolation is X : Integer := 12; Y : Integer := 15; Name : String := "Leo"; begin Put_Line (f"The name is {Name} and the sum is {X + Y}."); end Test_Interpolation; See the `String Interpolation RFC `_ for more details. Variables in Sequences of Statements ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ It is now possible to declare variables outside of sequences of statements, for example: .. code-block:: Ada if X > 5 then X := X + 1; Squared : constant Integer := X**2; X := X + Squared; else X := X - 1; Cubed : constant Integer := X**3; X := X + Cubed; end if; See the `Local Vars RFC `_ for more details. Storage_Model ------------- Storage_Model is an experimental Ada capability that allows an Ada access type to point to a non-native memory area. A typical example is a mixed CPU / GPU application where the memory residing on the GPU can be allocated, deallocated and accessed through specific functions. A pointer associated with a storage model will have user-defined function for allocation, deallocation, copy from the foreign memory to native memory and back. See the `Storage Model RFC `_ for more details. Platforms --------- GNAT Pro for CUDA ~~~~~~~~~~~~~~~~~ CUDA is a platform provided by NVIDIA to develop general purpose code on their hardware. The GNAT for CUDA product is relying on NVIDIA CUDA to allow Ada users to write Ada code running directly on NVIDIA GPU. It offers a binding to NVIDIA C API as well as an Ada compiler targetting directly the NVIDIA GPU intermediary machine language PTX. See the `GNAT for CUDA webinar `_ for more details. C++ for Bare Metal ~~~~~~~~~~~~~~~~~~ C++ support will be added to bare metal products targeting PowerPC, x86, RISC-V, LEON3 and ARM. Customers currently supported on C on these targets will get C++ support at no extra cost. This port will be provided with a reduced version of the standard C++ library, fit for development on small bare metal target with no OS support. Platform Status Changes ~~~~~~~~~~~~~~~~~~~~~~~ Hosts +++++ - GNAT Pro now supports Windows 11, both as a host and a target. - GNAT Pro no longer support Windows 8.1, Windows Server 2012 and 2012 R2 - GNAT Pro 24 is the last release supporting RedHat Enterprise 7 and Ubuntu 18.04 Targets +++++++ - GNAT Pro now supports VxWorks 7 versions released in 2023 (23.03 and 23.09). - GNAT Pro now supports VxWorks Helix on x86_64 targets, with VxWorks 7 Cert as a GuestOS. - GNAT Pro Ada for QNX ARM 32 is baselined, the last release is 23. Detailed New Feature List ------------------------- Optimizations ~~~~~~~~~~~~~ More efficient slice assignments in packed records ++++++++++++++++++++++++++++++++++++++++++++++++++ The object code generated for assignments from and to slices of unpacked arrays that are components of packed records is more efficient. Improved extended return for nonlimited by-reference ++++++++++++++++++++++++++++++++++++++++++++++++++++ Extended return statements present in functions returning a nonlimited by-reference type no longer incur a copy operation. Improved efficiency of slice-of-component assignment ++++++++++++++++++++++++++++++++++++++++++++++++++++ The efficiency of slice assignment is improved when the left- or right-hand side is a slice of a component or a slice of a slice. Previously, the optimization was disabled in these cases, just in case there might be a volatile or independent component lurking. Now we explicitly check all the relevant subcomponents of the prefix for volatility and independence. Optimize 2**N +++++++++++++ A redundant check is now avoided in the case of exponentiation by a power of 2 (which are normally turned into shifts). Better stack usage estimates for packed arrays ++++++++++++++++++++++++++++++++++++++++++++++ The compiler now gives better estimates of the stack storage used by arrays using the Pack pragma. Avoidance of duplicated streaming subprograms +++++++++++++++++++++++++++++++++++++++++++++ In some common cases, a reference to a streaming attribute for an untagged type caused the compiler to generate the needed subprogram "on demand". When there are multiple such references, (for example, two calls to Some_Untagged_Record_Type'Write), then it is better to avoid generating multiple essentially-identical subprograms; instead, a subsequent attribute reference can now "reuse" an already-generated subprogram (at least in some cases). Due to this optimization, a generated streaming subprogram may now have multiple call sites. This means the compiler can no longer use the source position information from the (one and only) call site. If an exception is raised during a streaming operation, this can affect the reported raise location. Optimized CW objects initialized by function calls ++++++++++++++++++++++++++++++++++++++++++++++++++ Stand-alone and return objects of a class-wide type that are initialized by a function call are now implemented more efficiently. Diagnostics ~~~~~~~~~~~ Tags associated with style messages +++++++++++++++++++++++++++++++++++ The compiler style messages (-gnaty* switch) are now displayed with their corresponding tag at the end of the line when the -gnatw.d switch is enabled (the default), as was already done for warning messages. Warnings suppressed on derived True/False +++++++++++++++++++++++++++++++++++++++++ GNAT no longer gives an "always True" or "always False" warning if the expression in question is the literal True or False of a type derived from Boolean that has convention C or Fortran. Previously, such cases caused a warning that was deemed to be unhelpful. New warning for ineffective static predicate tests ++++++++++++++++++++++++++++++++++++++++++++++++++ The compiler now emits a warning if a static predicate tests for a value that does not belong to the parent subtype. For example, in "subtype S is Positive with Static_Predicate => S not in 0 | 11 | 222;", the 0 is ineffective because Positive already excludes that value. Generation of this new warning is controlled by the -gnatw_s switch, which can also be enabled via -gnatwa. Better selectivity of warnings on deleted code ++++++++++++++++++++++++++++++++++++++++++++++ When passing the switch -gnatwt to track deleted code, GNAT now only issues warnings on branches that are not under a "statically disabled condition" as defined in SPARK User's Guide, section 7.3.2. This avoids spurious warnings on code deactivated through the use of a global configuration constant. New warning about noncomposing user-defined "=" +++++++++++++++++++++++++++++++++++++++++++++++ The new switch -gnatw_q enables a warning for a user-defined "=" that does not compose as might be expected (i.e. is ignored for predefined "=" of a containing record or array type). For example, if an access type has a user-defined primitive "=", then the default "=" for a record type containing a component of that access type ignores the user-defined "=". This switch warns in such cases. See RM-4.5.2(14/3-15/5, 21, 24/3, 32.1/1) for the exact Ada rules on composability of "=". Documentation ~~~~~~~~~~~~~ Improved documentation for -gnatw.h compiler switch +++++++++++++++++++++++++++++++++++++++++++++++++++ The -gnatw.h option enables warnings about "gaps" in record layout specifications. In the case of a "partial" layout specification, where the locations of some components are left unspecified, the resulting warnings may be incomplete or incorrect, and this behavior is now documented. Memory allocation and type conversions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Truncate for conversion from floating to fixed point ++++++++++++++++++++++++++++++++++++++++++++++++++++ Dynamic conversions from floating-point types to ordinary fixed-point types now truncate the value (toward 0) instead of rounding it (to the nearest number) if it is not exactly representable. This makes them consistent with both static conversions between these types and the value of the Machine_Rounds attribute, which is False for all fixed-point types. Rounding is still available either under the debug switch -gnatd.N or by explicitly using the Round attribute. Ensure minimum primary default stack size +++++++++++++++++++++++++++++++++++++++++ The gnatbind -d switch allows setting the default primary stack size for new tasks. The value set with this switch was formerly not checked to be at least the minimum stack size required by the target platform, but now the minimum required stack size will be used when the value passed to the binder is too small. Conversions from Big_Integer to large integer types +++++++++++++++++++++++++++++++++++++++++++++++++++ In Ada 2022, the generic packages Signed_Conversions and Unsigned_Conversions of Ada.Numerics.Big_Numbers.Big_Integers now support conversions to large integer types, for example Long_Long_Unsigned, as well as Long_Long_Long_Integer and Long_Long_Long_Unsigned on 64-bit platforms. Default stack size for tasks on Aarch64 QNX +++++++++++++++++++++++++++++++++++++++++++ The default primary stack size for native threads on Aarch64 QNX is 256 KB. The QNX runtimes now use the same default value for newly created tasks. Use large type in membership test of universal value ++++++++++++++++++++++++++++++++++++++++++++++++++++ The actual type used to perform a membership test applied to a nonstatic expression of a universal type, for example an attribute whose type is universal_integer and whose prefix is not static, is now large enough to avoid a range check failure in almost all cases. Dependencies ~~~~~~~~~~~~ Drop OpenSSL dependency for the mold linker +++++++++++++++++++++++++++++++++++++++++++ The mold binary distributed in the GNAT Pro toolchain no longer has a run-time dependency on OpenSSL: users no longer have to provide libcrypto in order to call this linker. Tunability ~~~~~~~~~~ Addition of gnatpp layout switch ++++++++++++++++++++++++++++++++ A --layout switch was added to gnatpp, which controls the general formatting style. The switch has the following options: default, minimal, compact, and tall. The default layout follows a compact style, but adds alignment and puts some keywords on a separate line. The minimal layout avoids changing the source layout by keeping all line breaks from the original source. The compact layout avoids adding line breaks and alignment by packing as many subexpressions on the same line as possible. Finally, the tall layout favors adding lines breaks and alignment. Exact real values used in JSON output with -gnatRj ++++++++++++++++++++++++++++++++++++++++++++++++++ The output generated by the compiler when the -gnatRj switch is specified now contains exact real values instead of decimal approximations. Finer control of GNAT-defined Ada extensions ++++++++++++++++++++++++++++++++++++++++++++ The -gnatX switch (and the related Extensions_Allowed pragma) was previously a two-valued all-or-nothing option. Now the compiler supports enabling a curated subset of the GNAT-defined Ada extensions without enabling others via the -gnatX switch, and will enable all of the language extensions via the new -gnatX0 switch. Similarly, the existing "ON" argument for the Extensions_Allowed pragma now only enables the curated subset; the new argument "ALL" enables all language extensions. The subset of language extensions currently includes prefixed-view notation with an untagged prefix, fixed-low-bound array subtypes, casing on composite values, and static intrinsic functions. Users of other GNAT-defined extensions may have to update switch settings (replacing "-gnatX" with "-gnatX0") or pragma arguments (replacing "On" with "All"). New switch -gnatyz and improvements to -gnatyx ++++++++++++++++++++++++++++++++++++++++++++++ The -gnatyx switch now checks for case statements and ranges. In addition, a new switch -gnatyz is introduced to check for unnecessary parentheses according to operator precedence rules. The switch -gnatyg enables -gnatyz by default. New switch to set reverse Bit_Order threshold to 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ The switch -gnateH has been implemented to set the threshold of reverse Bit_Order clauses, as defined by RM 13.5.1(13.3/2), to 64. Packaging ~~~~~~~~~ PIE enabled by default on Native Linux ++++++++++++++++++++++++++++++++++++++ GNAT now generates Position Independent Executable (PIE) code by default. PIE binaries are loaded into random memory locations, introducing an additional layer of protection against attacks. With previous versions, it was possible to build PIE executables, but this feature had to be enabled explicitly during both the compilation and the link. Runtimes ~~~~~~~~ CCG: Interfaces.C.Strings added to the runtime ++++++++++++++++++++++++++++++++++++++++++++++ GNAT CCG now includes the predefined package Interfaces.C.Strings in its runtime. Ada.Iterator_interfaces added to the CCG runtime ++++++++++++++++++++++++++++++++++++++++++++++++ The CCG compiler now provides the Ada.Iterator_interfaces unit, to allow user-specified iteration. Handle pthread errors in LynxOS-178 tasking rt ++++++++++++++++++++++++++++++++++++++++++++++ The Delay_Until implementation of the light-tasking runtime on LynxOS-178 now raises an exception if pthread_cond_timedwait returns an unexpected error. Language features ~~~~~~~~~~~~~~~~~ Extend Round attribute to ordinary fixed point types ++++++++++++++++++++++++++++++++++++++++++++++++++++ The Round attribute specified by the Ada RM for decimal fixed point types is now also available for ordinary fixed point types. Atomic store primitives in System.Atomic_Primitives +++++++++++++++++++++++++++++++++++++++++++++++++++ The System.Atomic_Primitives unit now exposes atomic store primitives alongside the existing atomic load primitives. User-defined literal aspects for derived untagged +++++++++++++++++++++++++++++++++++++++++++++++++ The subprograms named in Ada 2022 user-defined literal aspects of untagged types can now be overridden by their derived types.