GNAT Pro 23 Release Notes¶
We present here a few highlights of the new features in GNAT Pro 23. You can access the complete list on the GNAT Pro 23 feature file.
Compiler¶
GCC Back-End Update¶
The GNAT compiler has now been updated to GCC 11. See this page for the corresponding capabilities of the back-end, as well as updates to C and C++.
Binary Code Hardening¶
The Ada and C compilers can now generate code hardened against external tampering and back doors. Three specific capabilities are available:
Hardened Booleans: Booleans are represented by value far from one another from a hamming distance point of view as opposed to 0 and not 0
Hardened Conditionals and Control Flow: Additional verifications are inserted in the binary code to detect branch “glitches” where an attacker would skip over specific instruction to access code he shouldn’t otherwise be able to execute.
Registers and Stack Scrubbing: Memory from stack and registers can be erased upon exiting certain functions.
For more details, see the documentation.
New code generator for CCG¶
The GNAT Common Code Generator is a special compiler able to compile a subset of Ada and SPARK into C. In the context of the 23 release, it has been completely rewritten, taking advantage of some of the work that was shared with the LLVM back-end. This expands greatly the Ada and SPARK features that are supported by the tool, for example representation clauses. However, note that the generated C code is still to be considered as an intermediary artifact, at the same level as compiler internal representation.
GNATkp for Assurance subscriptions¶
A new tool GNATkp allows analyzing Ada code against the known problems of a particular release and target, to determine wether your code is impacted by known toolchain issues. This tool is exclusive to GNAT Pro Assurance. See the GNATkp documentation for more details.
Compiler JSON output¶
JSON output of the compiler (-fdiagnostics-format=json) has been expanded:
-gnatdJ will include subprogram names
-gnatef will include absolute path
a new field is added mentioning the cause of the error / warning if known
Ada Support¶
Aggregates improvements¶
Ada 2022 now allows aggregates (enclosed in square brackets) for constructing values of homogeneous containers:
They are supported for container aggregates
They can be used as expression function results
null array aggregates [] are now supported
They can be used as default expressions for generic formal functions
They can be used for set containers
Default expressions for generic formals functions¶
As an experimental feature, generic formal functions can now have default values
New Restrictions¶
No_Local_Tagged_Types: only library-level tagged types are allowed.
No_Tagged_Type_Registration: features requiring tagged types registrations are forbidden (usage of streams and Ada.Tags) simplifying the output code.
Lock-Free enabled by default¶
Lock-Free is an aspect applied to a protected type that allows the compiler to implement it without the use of a system lock, greatly improving performance. This aspect is now applied by default when available and possible.
Static encapsulated stand-alone library support¶
GPRbuild now supports both static and dynamic encapsulated libraries.
Warnings and Error Reporting¶
Better error messages for incorrect dot notation usage for calls
Instance names added to error messages for non-visible declaration within generic instantiations
Better expected type error messages for subtypes
Error messages now include full package names
The No_Dependence restriction now also flags dependencies on units in the runtime library implicitly used by the compiler
New warning on unused variable in quantified subexpression
New warning on differing subtypes that fully conform
New warning for with of ancestor of current unit
New warning for subtype with a compile-time-known null range
New warning on unreferenced generic units
Better detection of integer overflow
More selective warnings given by code generator
The warnings given by the code generator for Ada programs are now restricted by default to objects actually present in the source code and not to internally generated objects.
More GNAT warnings are now tagged with their corresponding switches. Some tags have been refined from -gnatwm to -gnatw.o, as -gnatw.o represents a more precise subset of warnings emitted by -gnatwm.
New warning when an unset object is referenced immediately within a conditional expression
The unreachable-code warning now takes into account the No_Return pragma
Support for the mold linker¶
The GNAT Pro toolchain for native Linux platforms now includes the mold linker, a fast, drop-in alternative for GNU ld and gold.
Libadalang¶
Introduction of the LangKit Query Language (LKQL) allowing users to write queries on the Ada source.
Many API additions and fixes, see Libadalang documentation for details.
Many fixes and improvements in the name resolution and navigation engine.
Extended support for the Ada language, including Ada 2022
Library Licensing¶
Some libraries are moving from a GPL v3 + exception licensing to Apache 2.0:
langkit
libadalang
This should have no impact on GNAT Pro users, as the GPL v3 + exception and Apache 2.0 both allow usage in the context of proprietary software. More details on the Apache licensing blogpost.
Platforms¶
New Targets¶
AArch64 QNX 7.1
AArch64 RTEMS
VxWorks 7 22.03, 22.06, 22.09
VxWorks 7 cert Helix AArch64
Ubuntu 22.03LTS
WSL 2
Windows server 2022 & Windows 11
Platform Status Changes¶
Ubuntu 18.04LTS no longer supported
Component Changes¶
GNAT Pro Enterprise 22 was the last release including Gcov. Starting 23, Gcov is bundled with the GNAT Dynamic Analysis package. This is a temporary measure, as Gcov is meant to eventually be completely replaced by GNATcoverage. Gcov will remain in the GNAT Pro Long-term Support (LTS) and Assurance product branches prior to GNAT Pro 23.
Starting with 23.0, GNATcheck and GNATmetric are bundled with our Static Analysis Suite (CodePeer component). GNATcheck and GNATmetric will remain in the GNAT Pro Long-term Support (LTS) and Assurance product branches prior to GNAT Pro 23.