AdaCore Release Notes¶
GNAT Pro 27 Release Notes¶
We present here a few highlights of the new features in GNAT Pro 27. You can access the complete list in the GNAT Pro 27 feature file.
GCC back-end update¶
The GNAT Pro Ada, C and C++ has now been updated to GCC 15. See the GCC 15 changes for the corresponding capabilities as well as updates to C and C++.
GNAT Pro LLVM¶
The GNAT Pro LLVM for Ada compiler has now been updated to LLVM 21. See the LLVM 21 release notes for the corresponding capabilities.
New toolchains¶
GNAT Pro for Ada adds support for ARM 64-bit targets on Android¶
The GNAT Pro Ada toolchain is now available on Windows and Linux hosts targeting ARM 64-bit (aarch64) on Android OS. This enables deployment of Ada applications on Android OS 10, 11 and 14 versions.
LLVM-based Ada compilers for 32-bit Linux/Windows¶
Native variants of GNAT Pro LLVM for Ada are now available for 32-bit Windows and Linux (platform names x86-windows and x86-linux), complementing the already available x86_64 variants. The compilers themselves are 64-bit programs, requiring a 64-bit operating system to execute (like their GCC-based counterparts). The binaries that they produce are 32-bit binaries suitable for execution on 32-bit operating systems, targeting the Pentium 4 processor by default.
GNAT Pro LLVM for Ada targeting riscv64-elf¶
The new riscv64-elf-linux64 port of the LLVM-based Ada compiler targets bareboard systems using the 64-bit flavor of the RISC-V architecture. The compiler is hosted on Linux. It includes the same set of Ada runtime libraries as its GCC counterpart. Like the other GNAT Pro LLVM toolchains, it uses the LLVM back-end and links with the LLVM linker lld.
New LLVM-based C compiler package¶
GNAT Pro LLVM for C is a new package containing Clang, the LLVM-based C compiler, as well as support programs like the GPR tools and the code formatter clang-format. Clang is configured to use LLVM components by default, in particular the LLVM linker lld and the LLVM stack unwinder libunwind (both included in the package). GNAT Pro LLVM for C is currently available as a native toolchain for Linux and Windows on x86 and x86_64.
New LLVM capabilities¶
New switch -gdwarf-aranges in GNAT Pro LLVM for Ada¶
The new switch -gdwarf-aranges causes the compiler to emit the additional section .debug_aranges when generating debug information. The Ada runtime needs this section to produce symbolic tracebacks. The gprbuild tool adds the new switch automatically.
New switch -fno-builtin in GNAT Pro LLVM Ada¶
The new switch -fno-builtin disables the compiler’s implicit builtin knowledge of functions. This prevents it from detecting custom implementations of common library functions like strlen and replacing them with calls to the corresponding libc function. The intended use is bareboard environments where libc is unavailable.
New option -mllvm in GNAT Pro LLVM for Ada¶
The LLVM-based Ada compiler now supports “-mllvm” for forwarding arbitrary switches to LLVM, mirroring the mechanism available in Clang. Whenever the command line contains “-mllvm”, the option immediately following it is passed through to LLVM. This can be used to influence advanced LLVM features for which no command-line option exists in GNAT Pro LLVM.
New LLVM switch -menable-experimental-extensions¶
The new switch is needed with GNAT Pro LLVM for Ada when using RISC-V extensions that LLVM considers experimental, for example because they have not been ratified yet.
GNAT language extensions¶
New attribute From_Address¶
The From_Address attribute is a GNAT-defined attribute that (typically) takes an address and a set of array bounds and yields a value of an extended access type; that value designates an array at the given address having the given bounds.
Unsigned_Base_Range aspect¶
A new pragma/aspect, Unsigned_Base_Range, has been added to explicitly enforce the use of an unsigned base type for signed integer types.
Attribute subprograms¶
The GNAT compiler now supports an extension feature that allows declaring primitive subprograms whose name has the form of an attribute name (where the prefix is the type for which the subprogram is a primitive), in cases where the attribute names correspond to aspects that denote a subprogram. Specifically, this is supported for the indexing aspects, user-defined literal aspects, Default_Iterator, Put_Image, stream attributes, and constructors. Declaring such a subprogram has the effect of defining the corresponding aspect for the associated type. Use of this feature requires compiling with the -gnatX0 option.
Language conformance¶
Component clauses for unchecked union components¶
The compiler now accepts component clauses for record components of unchecked union types.
Support for declare expressions of limited types¶
When compiling for Ada 2022, declare expressions of limited types are now accepted by the compiler.
More conformant freezing for expression functions¶
The implementation of the freezing rules of the language for expression functions has been improved. As a consequence, some legal constructs that were rejected by the compiler are now accepted, and some illegal constructs that were accepted by the compiler are now rejected; in this latter case, a very verbose error message is given.
Check for coupled address and alignment clauses¶
The compiler now performs a run-time alignment check on all machines for an object declared both with an address aspect/clause and an alignment aspect/clause, in order to avoid the erroneous execution specified by the RM 13.3(27) subclause.
Improved resolution for indexing aspects¶
Ada’s rules for resolving indexing aspects have been revised (by AI22-0154-1) to be more specific in terms of parameter and result types for functions denoted by those aspects. This has the effect of ensuring that within the scope of a type T that specifies an indexing aspect, other types declared in that same scope that have primitives with the same name as the function name given in T’s aspect will not make that aspect illegal.
Streamlined implementation of subpools and AI12-0331¶
The implementation of storage subpools has been streamlined and the Binding Interpretation specified by AI12-0331 has been implemented.
Enhanced implementation of Valid_Scalars attribute¶
The Valid_Scalars attribute now works for tagged extensions.
Nonconfirming size clauses on floating-point objects¶
Nonconfirming size clauses on objects of floating-point types are now all rejected (only those specifying a size less than that of the subtype of the objects were previously rejected).
Restriction lifted on Valid_Scalars attribute¶
The Valid_Scalars attribute now works for private tagged types.
Accessibility checks¶
Better implementation of static accessibility checks¶
A few loopholes have been plugged in the implementation of static accessibility checks affecting the different versions of the language:
in Ada 2005, illegal assignments to objects of anonymous access types done in extended return statements are now flagged,
in Ada 2005 and 2012, illegal conversions between access types done in extended return statements are now flagged,
in Ada 2012, more cases of illegal actuals passed for explicitly aliased formal parameters in calls present in return statements are now flagged,
in Ada 2022, the relaxed rules for explicitly aliased formal parameters are now implemented.
Better error message for static accessibility checks¶
The error messages given for the failure of static accessibility checks now have a more consistent wording and mention the corresponding Ada RM rule.
More robust implementation of dynamic accessibility¶
The implementation of the dynamic accessibility checks that are specified by the Ada RM to prevent dangling references has been overhauled.
Strict accessibility checks for container references¶
The compiler now generates strict accessibility checks for the manual invocation of the Reference or Constant_Reference functions of the various containers declared in the run-time library. In particular, it is no longer possible to get an access value designating a specific element of the container by using those functions and save it away; instead the element must be accessed directly through values of the reference types (possibly stored in local variables).
Run-time library¶
Light runtime can now be rebuilt in static PIC mode¶
It is now possible to rebuild the light Ada runtime in static PIC mode. To do so, set the scenario variable LIBRARY_TYPE to “static-pic” when invoking gprbuild, i.e., “gprbuild -XLIBRARY_TYPE=static-pic -P runtime_build.gpr”. Previously, only the values “static” and “dynamic” were allowed. The main use case for the static PIC build is shared encapsulated stand-alone libraries.
Better aborts for suspension objects¶
Aborting tasks waiting in calls to Ada.Synchronous_Task_Control.Suspend_Until_True now reliably unblocks the aborted tasks.
Bareboard No_Standard_Allocators_After_Elaboration¶
Restriction No_Standard_Allocators_After_Elaboration is now supported on all bareboard runtime profiles.
New Calling_Entity function¶
The function System.Traceback.Symbolic.Calling_Entity is now available on systems that support symbolic debugging information. It provides a convenient way to get information about the calling subprogram, for example for logging purposes.
Ada.Command_Line.Environment easier to use¶
Ada.Command_Line.Environment no longer requires initializing a gnat_envp variable for proper operation when used with a non-Ada main.
Bounded_Indefinite_Holders added to runtime library¶
The predefined unit Ada.Containers.Bounded_Indefinite_Holders, as described Ada RM A.18.32, has been added to the GNAT runtime library.
Deterministic streaming of Long_Long_Float¶
On some platforms, Long_Long_Float uses IEEE extended precision, which only uses 80 bits per value, but is padded to 128 bits for streaming. The compiler now consistently sets the padding bits to zero.
Windows enhancements¶
Thread descriptions for Ada tasks on Windows¶
On Microsoft Windows, GNAT now uses SetThreadDescription for the threads that underlie Ada tasks. The descriptions are the names of the tasks as found in the Ada source code. This makes it easier to identify threads created by the GNAT runtime in system-monitoring tools.
Native TLS support on Windows platforms¶
The compiler now implements native Thread Local Storage support on Windows platforms.
Switch from MSVCRT to UCRT on Windows platforms¶
The compiler now uses UCRT instead of MSVCRT as the underlying C runtime library on Windows platforms. The exception is the Win32.CRT binding, which is part of the Win32Ada library and still uses MSVCRT.
Optimizations¶
Better code for BIP calls with controlled components¶
The GNAT compiler now generates more efficient code for calls to build-in-place functions with a fixed-size limited record result that has controlled components. These formerly required allocation of the result on the secondary stack, but now the storage for the result can be allocated on the caller side.
Faster copy of small discriminated record objects¶
Copy operations generated between small local objects whose nominal subtype is a discriminated record type with default discriminants and a variant part are now implemented more efficiently.
Speedup of Bounded_Vectors.Append in some cases¶
In (any instance of) Ada.Containers.Bounded_Vectors, for the procedure overload of Append that takes exactly two parameters (one of type Vector, one of type Element_Type), the execution time is reduced in the case where either of the GNAT-defined checks Container_Checks or Tampering_Check are suppressed.
Reduced dependency footprint of ignored assertions¶
The compiler will now remove any dependences on packages that originate from ignored assertion pragmas.
Diagnostics¶
Style-check warning for indented compilation units¶
GNAT now emits a style-check warning on compilation units where the unit’s initial keyword (such as “package” or “procedure”) is indented.
Better error on invalid prefix in selected component¶
The compiler now gives a more precise and/or more verbose error message for an invalid prefix in a selected component.
Warn for unused use_package_clauses in more cases¶
The compiler now gives a warning for unused use_package_clauses even when a use_package_clause for a child package is also present.
Tools¶
Alire for GNAT Pro is now available¶
Alire (Ada LIbrary REpository) is now available as part of GNAT Pro. Alire for GNAT Pro provides a package manager approach to managing Ada libraries and components.
Hosts¶
Alire for GNAT Pro is available on the following hosts:
x86_64 Linux
x86_64 Windows
Aarch64 Linux
Alire Crates for GNAT Pro is now available¶
The initial release of Alire for GNAT Pro ships with a number of crates including:
gnatcoll
libgpr2
libadalang
xmlada
Alignment of keywords in record rep clauses¶
GNATformat now aligns the at and range keywords on consecutive
record representation clauses.
h2ads adds subtype defs for types from other scopes¶
When a header uses a type from an included scope, in a variable declaration, or in a function signature, h2ads now introduces a subtype definition as a shortcut to the original type, making the bindings more user-friendly.
GNATformat keyword casing control¶
GNATformat now allows controlling keyword casing using the new
--keyword-casing CLI option (keep [default], lower, upper) or via the
Format’Keyword_Casing attribute in GPR project files.
GNATpolyglot (beta) is available¶
GNATpolyglot, an automated binding generating utility designed to facilitate the development of mixed language applications is available in a beta release. This includes support for binding generation to enable calling Ada code from C++, Rust, and Java.
GPRBuild2 is now selected by default¶
In the 26 release we introduced GPRbuild2, the successor to our build orchestration tool GPRBuild. As of the 27 release, GPRbuild2 is the build engine selected by default. GPRbuild2 models the build as a directed acyclic graph (DAG) of actions, and includes support for user-defined actions. You can find additional details about GPRbuild2 in the User Guide.
GtkAda 4 is now available¶
GtkAda 4 introduces many changes from GtkAda 3. GtkAda 3 will remain available for some time, and AdaCore support can assist with any issues encountered as projects are transitioned to GtkAda 4. GtkAda-specific widgets are not yet available in GtkAda 4. For more information, please consult the GtkAda transition guide in the documentation.
XML/Ada hardening¶
Disabling of external generics, parameters, and DTDs¶
New SAX features have been added for disabling the loading of external generic entities, parameter entities, and doctype definitions (DTDs).
Restricting expanded entity counts and size¶
New SAX limits have been added to allow restricting the maximum number of expanded entities and the total size of expanded text.
Disabling of XML Doctype Declarations processing¶
A new SAX feature has been added for disallowing Doctype Declarations (DTDs) entirely during parsing.
GNAT Pro for Rust 27 Release Notes¶
We present here a few highlights of the new features in GNAT Pro for Rust 27.
Rust Version¶
This release of GNAT Pro for Rust is based on Rust version 1.93.0.
Vulnerability report¶
You can download the GNAT Pro for Rust 27.0 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.
Platforms¶
New Platforms¶
GNAT Pro for Rust 27.0 is now available on the following new platforms:
ARM32 Bare Metal (no_std), hosted on Linux
Existing Platforms¶
GNAT Pro for Rust 27.0 is already available on the following platforms:
Hosts¶
x86_64 Linux
x86_64 Windows 11
Targets¶
Aarch64 Bare Metal (no_std), hosted on Linux and Windows
Aarch64 Linux, hosted on Linux
Aarch64 Linux, hosted on Windows
Aarch64 QNX 8.0, hosted on Linux
Aarch64 VxWorks 7 version 25.09, DKM (no_std), hosted on Linux and Windows
Aarch64 VxWorks 7 version 25.09, RTP, hosted on Linux and Windows
x86_64 Linux
x86_64 Windows 11
Tools¶
GNAT Pro for Rust 27.0 includes the following tools:
Toolchain¶
cargo
rustc
rustfmt
gcc (for linking only)
binutils
gdb
Multi-Language Build Support¶
gprbuild
gprclean
gprconfig
gprinstall
gprinspect
gprname
IDE and Analysis¶
rust-analyzer
clippy
ZynqMP BSP¶
GNAT Pro for Rust 27.0 includes a Board Support Crate for the AMD Zynq UltraScale MPSoC. See the documentation for more information.
Libtest Support for no_std Targets¶
GNAT Pro for Rust 27.0 provides libtest support for no_std targets through the ZynqMP BSP. See the documentation for more information.
GPRbuild Integration¶
GNAT Pro for Rust 27.0 provides full integration with GPRbuild. This support allows you to include Rust library crates in your Ada projects, and inversely, to include Ada stand-alone libraries in your Rust binary crates. See the documentation for more information.
GNAT Dynamic Analysis Suite 27 Release Notes¶
We present here a few highlights of the new features in GNAT DAS 27. You can access the complete list in the GNAT DAS 27 feature file.
GNATcoverage instrumentation¶
Support for non-Latin-1 in Ada sources¶
“gnatcov instrument” may fail to parse Ada source files that have non-ASCII codepoints if the files are not encoded in Latin-1 (the default encoding in GNAT, and thus in gnatcov). It is now possible to specify the encoding of Ada source files with the –ada-default-charset switch passed to “gnatcov instrument” to get gnatcov to parse these source files correctly. Note that gnatcov is also able to detect the presence of -gnatW8 compiler switches in project files to select UTF-8 as the default encoding.
Extend integrated instrumentation support¶
Add integrated instrumentation support to Windows and cross configurations.
Avoid instrumenting static decisions in C and C++¶
GNATcoverage now avoids performing MC/DC instrumentation of boolean decisions in static contexts, which formerly made the code invalid.
Incremental instrumentation¶
GNATcoverage instrumentation now operates incrementally, thus it will not re-instrument sources with no code change between two instrumentations run, if the set of switches to the instrumentation command does not change.
GNATcoverage analysis and reports¶
Automatic source relocation at reporting time¶
When using gnatcov coverage, if a source file isn’t found at its absolute path, GNATcoverage will automatically try to search for it in the sources of the given project file, if given. This resolution method relies on matching the base name of the file, so it will fail if the project contains several source files with the same base name. Additionally, this feature is entirely disabled whenever the –source-rebase or –source-search options are given to GNATcoverage.
Gnatcov logging of coverage origins¶
Gnatcov is now able to provide the origins of coverage. An origin of coverage of a Source Coverage Obligation (SCO) is a trace file or checkpoint that contributed to the computation of the “covered” or “partially covered” state of the SCO for a given coverage level. The logging of coverage origins can be enabled through the use of the switch “–origins” when computing coverage with “gnatcov coverage”. The origins of coverage are included in XML coverage reports.
Gnatcov trace reuse after source annotation changes¶
It is now possible to pass to gnatcov coverage trace files produced with source files when these source files were amended to add/remove empty lines, comment-only lines, or annotations (pragma Annotate in Ada) after traces production. Note that in the case of instrumented sources, it is still necessary to reinstrument the source files before passing the trace files to gnatcov coverage.
GNATcoverage annotations and exemptions¶
Add VSCode support for external annotations¶
VSCode now displays external annotations in a tree-like view, below to the “Outline” panel on the left. External annotations are also visible by default in the editor, assuming the user specified an external annotation file in the project file. They can be toggled on and off. Finally, the user can create external annotations from the editor, at the cursor location, or by selecting a code region.
Extraction of in-source annotations¶
GNATcoverage now has a “gnatcov extract-annotations” command to turn in-source annotations to external annotations. This commands also accepts a “-i” switch to remove in place the in-source annotations.
Fine-grained exemptions for code coverage¶
In addition to the existing exemption regions supported in GNATcoverage, it is now possible to define exemptions that affect precise source-coverage obligations: a decision outcome, a condition, or provide evaluation vectors for a decision.
GNATcoverage usability¶
“gnatcov setup”: new –compiler-prefix switch¶
“gnatcov setup” now accepts the –compiler-prefix switch, as a convenient alternative for –prefix=DIR, where DIR is the installation prefix of the relevant compiler. This compiler is resolved according to the current target and RTS (–target/–RTS/–config/… switches).
Enhanced GNATcoverage limitations interface¶
GNATcoverage used to emit several warnings because of tool limitations. It now features a distinct message category reserved for tool limitations. While these messages are not preceded by the “warning:” prefix, these messages will still trigger failure status code if –warnings-as-errors is passed to the gnatcov invocation. Limitation messages can be ignored by passing the newly introduced –suppress-limitations switch, in which case the messages will not be emitted. The corresponding “undetermined coverage” messages will still be present in the coverage report for the affected constructs. These warnings were not always actionable (for plain unsupported constructs), and ignoring these messages never led to a loss of information, as the limitations are also reported in the coverage reports in the form of “undetermined coverage” messages associated with the corresponding constructs.
Support for aggregate library projects in gnatcov¶
GNATcoverage now accepts loading aggregate library projects: they were rejected when passed through -P to any gnatcov command.
GNATtest input generation¶
Test input generation through constructor functions¶
GNATtest can now generate test inputs using a "constructor" function. Once a constructor has been identified for a given type, either by an explicit user annotation or by searching for a suitable candidate, GNATtest will generate test inputs for the parameters of the constructor and will use its return value as input of the subprogram under test. This enables automatic test input generation for types that are not natively supported by gnattest, such as access types, or class-wide types, and also lets users provide a parametrized test input generation function more suited to the actual behavior of the subprogram under test.
Support discriminated tagged types in Gnattest¶
Gnattest is now able to generate test values for discriminated tagged types with ‘–gen-test-vectors’. One limitation exists: the discriminants of the tagged type must not be used to constrain an array.
GNATtest stubbing¶
Stubbing of imported subprograms¶
GNATtest now stubs subprograms with an Import aspect or pragma. When needed, gnattest will duplicate the concerned spec file to remove the Import pragma or aspect and others related aspects. This feature is disabled by passing the flag –no-external-stub to gnattest.
GNATtest –recursive-stub switch now implies –stub¶
GNATtest –recursive-stub switch used to need to be passed alongside –stub for recursive stubbing to occur. Now –recursive-stub automatically implies –stub and can be used on its own.
New option to select which unit to stub¶
A new GNATtest switch –include-for-stubbing has been added which allows the user to select which unit to stub. This switch has an opposite effect to –exclude-from-stubbing.
GNATtest setup and project integration¶
Extend the user project config in gnattest harness¶
The gnattest_common.gpr file holding configuration for the harness and stub projects now extends the user project configuration. Note that this is the case for newly created harness only, as gnattest_common.gpr is not regenerated by a rerun.
Refactor GNATtest to pass more information to AUnit¶
AUnit used to accept a single string that would contain information such as Sloc, unit name, test status (passed/failed),… To better support XML reporting, this string was transformed into a record with a field for each piece of information needed. GNATtest generator was updated to account for this new format.
Introduce a gnattest setup command¶
The gnattest setup commands builds and installs AUnit, and TGen (the library used by gnattest for test generation capabilities and integration with gnatfuzz). It picks the adequate AUnit profile, according to the target and the runtime passed by the user.
GNATtest uses custom suffixes for generated sources¶
The user gpr project file may define custom suffixes for Ada spec and body files. GNATtest now fetches this information from the project file and uses these suffixes for all files it will generate.
AUnit¶
Support JUnit XML report format¶
Add possibility to output test reports from AUnit in the JUnit XML format.
Add a Generic_Assert variant¶
Add a Generic_Assert variant to AUnit, comparing an actual and an expected value, and displaying them when they differ.
GNATfuzz language and platform support¶
Support for tagged types¶
GNATfuzz can now fuzz subprograms whose parameters are of tagged types. See the GNATfuzz User’s Guide for the remaining limitations.
GNATfuzz support for Windows is out of beta¶
GNATfuzz support on Windows is no longer a beta feature. The fuzz-everything and Hot-Spot workflows now also run on Windows, and overall reliability on this platform has been improved.
GNATfuzz support for the C language¶
GNATfuzz can now fuzz C functions directly, with no need to write Ada bindings first. The atomic GNATfuzz commands support C, and the –asan switch detects memory errors. See the GNATfuzz User’s Guide for details.
GNATfuzz workflows¶
New import-tgen-vectors utility command (beta)¶
The new “gnatfuzz import-tgen-vectors” command adds existing test vectors, for example those produced by GNATtest, to the starting corpus of a fuzzing campaign. This feature is in beta.
GNATfuzz Hot-Spot workflow (beta)¶
GNATfuzz has a new Hot-Spot workflow command that automates Static to Dynamic Analysis Security Testing verification. It takes a SARIF file of GNAT SAS static analysis warnings and uses fuzzing to determine which warnings can actually be triggered at run time. For each subprogram carrying warnings, the workflow generates a fuzzing harness (searching the call graph for a fuzzable caller when the subprogram cannot be fuzzed directly), runs a time-bounded campaign, and cross-references discovered crashes against the original warnings with a confidence rating. Results are written progressively to an augmented SARIF file containing reproducer commands, decoded crash inputs, and stack traces, alongside a combined GNATcoverage report. See gnatfuzz hot-spot –help for usage.
Add build stage¶
A new stage called “build” has been introduced. Previously, the gnatfuzz generated harness was built during the fuzzing stage. As of now, the harness must be built using the “build” sub-command, allowing the reuse of the same harness between fuzzing campaigns. See the GNATfuzz User’s Guide for more details.
Introduce a minimize-corpus stage¶
A dedicated, optional “minimize-corpus” stage has been introduced. Corpus minimization, which was previously integrated into the fuzzing stage, now requires explicit execution via the minimize-corpus command. This change enables manual management of minimized corpora and allows them to be reused across multiple fuzzing campaigns. For further details, please refer to the GNATfuzz User’s Guide.
Fuzz-everything workflow is out of beta¶
The fuzz-everything workflow is no longer a beta feature. It is more robust, runs on Windows, and can reuse the test cases generated by previous sessions as a starting point.
GNATfuzz usability¶
Early check of fuzzing engine combinations¶
GNATfuzz now detects invalid combinations of fuzzing engines earlier and gives clearer error messages about them.
Shorter paths for generated harnesses¶
GNATfuzz now uses shorter names for the directories it generates. This reduces the risk of reaching path length limits, in particular on Windows.
Harness directory argument replaces -P¶
The GNATfuzz commands that work on a generated harness now take the harness directory as an argument, which makes the command line simpler. The previous -P form is still accepted.
CodeSonar for Ada Release 27.0: Release Notes¶
Notes on Upgrading¶
The minimum CodeSonar version for a direct upgrade to CodeSonar 27.0 or later is 7.2p0. If you have a hub that is running CodeSonar 7.1p0 or earlier, contact CodeSonar support for assistance in upgrading.
If you have made changes to any of your CodeSonar configuration files, you must upgrade those files as part of the upgrade process, and for some of them the procedure includes steps that must be carried out before CodeSonar is upgraded.
See MANUAL: Upgrading Configuration Files for instructions.
If you are upgrading a CodeSonar installation that will be used by someone else:
Determine the most appropriate person to upgrade the general template and compiler template configuration files. This will depend on local factors such as who usually makes changes to these files.
CodeSonar for Binaries has been baselined: CodeSonar 9.2 was its final release. Use CodeSonar 9.2 to perform binary analyses going forward.
The ``codesonar activate`` subcommand has been removed. It is no longer needed.
CodeSecure, Inc. has merged into AdaCore, and product branding has changed accordingly. Points to note when upgrading:
On Windows, the default installation directory is now
...\AdaCore\CodeSonar, and the installer records its settings under the Software\AdaCore\CodeSonar registry key. The installer will detect an existing CodeSecure-era or GrammaTech-era installation and offer to uninstall it.The Java plugin API package has been renamed from com.codesecure.cs to com.codesonar.cs; update import statements in Java plugin sources.
The C API function cs_codesecure_home_directory() has been renamed cs_install_directory().
Windows device-driver installation has moved from hookcs.exe to codesonar. hookcs.exe –install and –uninstall no longer exist; use codesonar uninstall-driver and codesonar install-driver instead. Scripts
that follow the instructions given in the 3.5 and 3.6 release notes
must be updated: where those notes gave the single invocation
hookcs.exe --uninstall --install,
the replacement is two commands, and the uninstall must come first —
installing over an existing registration leaves the registered driver
in place.
The new subcommands exist on every platform and succeed without doing anything where there is no driver, so a portable script need not test the platform.
Configuration files that are not encoded in UTF-8 are now diagnosed. CodeSonar has always treated configuration file text as UTF-8, but ill-formed bytes were passed through silently. Such a file now raises a Bad Configuration File Setting alert, naming the file and the first line on which invalid bytes appear, and every line containing those bytes is ignored rather than used — so a setting that previously took effect by accident will no longer do so. Plain ASCII is UTF-8, so only configuration files holding non-English text are affected; re-save any such file as UTF-8. A byte-order mark at the start of a configuration file is now ignored instead of being taken as part of the first parameter name. See File encoding.
If you have previously installed the CodeSonar plug-in for Visual Studio or CodeSonar plug-in for Eclipse, upgrade those installations after upgrading CodeSonar.
Existing “Use of catch” warnings get a new fingerprint on upgrade. The warning now includes the enclosing procedure where one exists (see Warning Class Changes), and procedure identity is part of the fingerprint, so most existing “Use of catch” warnings are re-keyed as new findings. Triage state attached to the old fingerprint (assigned, annotated, or marked expected) does not carry over to the new one.
Source file patches from one directory are now applied in ascending order of patch file name, compared byte by byte. Where two patches apply to the same region of a file, the result no longer varies between machines or locales.
The header patch for arm_neon.h as shipped with GCC 9.3 is now applied. Analyses of ARM code built with GCC 9.3 may report differently.
A ``std::vector`` built from a braced initializer list now has a known size. The header patch for libstdc++’s bits/stl_vector.h has been updated. Analyses of C++ code that constructs vectors this way may report differently: overruns of the vector’s storage that were previously missed are now reported, and null pointer dereferences of data() are not.
Missing Parentheses (LANG.STRUCT.PARENS) now reports operands it previously missed. An operand that is a compile-time constant, or that needs an implicit conversion, is now reported. A project that enables this class may therefore see new warnings after upgrading, on code that has not changed. Every MISRA, AUTOSAR, CERT C, and JPL preset that maps this class enables it.
What’s New¶
Version Numbering |
Versions are now year.point with no patch component, so this release is 27.0 rather than a successor to 9.2. Within a year, .0 is the Initial Release for early evaluation, .1 the Production Release for commercial deployment and .2 the Corrective Release for bug fixes and maintenance. Wavefronts and continuous releases, available on request to carry a fix or feature ahead of the next release, carry a suffix such as 27.0w. |
A new edition that analyzes Ada using a bundled GNAT SAS engine. See MANUAL: Build and Analysis for Ada Projects. |
|
The bundled EDG C/C++ front end has been updated from version 6.7 to version 6.9, broadening language coverage, improving compiler compatibility, and fixing code that previously failed to parse. |
|
AdaCore Branding |
CodeSecure, Inc. has merged into AdaCore. Product branding, installer metadata, documentation, and support contact points now refer to AdaCore. See Notes on Upgrading for renamed installation paths and API packages. |
Default HTTP Session Timeout |
The default HTTP session timeout for newly created hubs is now 60 minutes (previously 15 minutes). You can change this setting on the HTTP tab of the Admin Settings page. Existing hubs are not affected. |
There are modified warning classes for C/C++ and Java, a new Java warning class, and deleted Kotlin warning classes. |
|
Visual C++ Standard Library Models |
Analysis of code built with Visual C++ 2010 or Visual C++ 2015 (before Update 3) no longer reports spurious uninitialized-variable warnings on copies of a default-constructed std::istreambuf_iterator. |
Use of catch / Modification of Standard Namespaces Performance |
Analysis using the “Use of catch” (LANG.STRUCT.EXCP.CATCH) or “Modification of Standard Namespaces” (LANG.STRUCT.DECL.SNM) warning classes was previously very slow. The performance of both has been improved. |
There are some changes to C/C++ ASTs, and the plug-in API can now attach annotations to reported warnings. |
|
codesonar rename_roles.py |
This is a new |
codesonar set_user_roles.py |
This is a new |
MCP Server Configuration Control |
The CodeSonar MCP server can now restrict the AI agent’s analyses to a project directory you nominate, and its configuration files to directories you permit, using –project-dir and –conf-dir. –allow-build-command approves a build command in advance, which an agent whose client cannot be prompted requires in order to run an analysis at all. See MANUAL: What These Options Control. |
Bundled curl |
CodeSonar now uses curl 8.21.0, which picks up the fixes for the security advisories published against the 8.14.1 it replaces. Separately, the bundled curl is now built with support for HTTP and HTTPS only; the other protocols it used to carry, and NTLM authentication, are no longer compiled in, so advisories against those protocols no longer apply to the bundled build whether or not upstream has fixed them. |
MCP Progress Reporting |
The CodeSonar MCP server now reports progress while a CodeSonar command it spawned is running, so a client that asks for progress is told the work is continuing. Clients commonly abandon a tool call that has said nothing for long enough, which could end a long analysis or a large warning listing before it finished. |
|
|
Details¶
CodeSonar for Ada¶
CodeSonar analyzes Ada using GNAT SAS, AdaCore’s static analysis tool for Ada. A CodeSonar
for Ada installation bundles it, so no separate installation is
needed.
To include an Ada component, extend your CodeSonar-facing
build with one or more invocations of codesonar ada_scan.py, naming the GNAT
Project file (.gpr) to analyze, then
run the build/analysis as usual.
You do not need to build the project with gprbuild, or to observe any Ada compilation step, in order to analyze it.
codesonar ada_scan.py takes the project file rather than a list of source files. The Ada source files are derived from the project itself, together with the runtime and library units it refers to; the naming rules in the project’s
Namingpackage are honored.GNAT SAS warnings are exported in SARIF and imported into the CodeSonar project. Each GNAT SAS check corresponds to one of CodeSonar’s built-in Ada warning classes.
An Ada parser program, run alongside GNAT SAS, supplies procedure information and cross-references, which populate the Procedures tab and the cross-reference and code-search navigation.
CodeSonar for Ada carries no C or C++, Java or C# analyzers, and no Windows build wizard, plug-in for Eclipse or plug-in for Visual Studio. Use Build and Analysis for Ada Projects, which is a command-line workflow. The tier 3 scanners — Go, JavaScript, Python, and Rust — are unaffected.
One consequence of moving a configuration or a script from
another edition: the java and
dotnet compiler models
are not registered, and naming one reports which edition provides it
rather than reporting it as unknown.
CodeSonar for Ada does not require a license key: there is none to obtain, install, or renew. The configuration tool omits its Generate a license entry, and the License Key Utilization page omits its Request a new license key link.
Analyzing a project that contains both C/C++ and Ada requires a
CodeSonar for C/C++ installation, as CodeSonar for Ada does not
include the C/C++ front end. Run the build/analysis from the C/C++
installation. It bundles no gnatsas, so codesonar ada_scan.py looks for one on
PATH; put the gnatsas/bin directory of your CodeSonar for Ada
installation there, or name the program with -gnatsas.
C/C++ Parser Upgrade¶
The bundled EDG C/C++ front end has been updated from version 6.7 to version 6.9, spanning two upstream releases. This broadens language coverage, improves compiler compatibility, and fixes code that previously failed to parse.
Constructs that previously provoked a generic parse error are now diagnosed specifically. The new parser warning classes name the features involved, among them C++20 alias template deduction, the C++23 explicit object parameter, C++26 structured binding packs, and the C23
#embeddirective and_BitInttypes.Header patches that existed only to work around parser limitations have been removed where the parser now handles the construct itself. For example, the patches supplying a
__fp16typedef are gone, because the parser now supports__fp16directly in GCC mode. See Customer Tickets Fixed.
New C/C++ parser warning classes¶
There are many new warning classes corresponding to C/C++ parser warnings and parser errors. For a full list, see C/C++ Parser Warning Classes.
As with the existing parser warning classes, these are enabled by
default for C and C++, and a factory setting for WARNING_FILTER discards warning instances that
correspond to parser errors, so errors from the parse log are not duplicated as
CodeSonar warnings.
Deleted C/C++ parser warning classes¶
The following warning classes have been removed because the
underlying parser diagnostics no longer exist. A WARNING_FILTER rule naming one of these mnemonics
no longer matches anything.
Deleted Warning Class |
Mnemonic |
Notes |
|---|---|---|
Header Unit Creation Failure |
PARSE.HUCF |
|
IFC Bad Function Definition |
PARSE.IFCBFD |
|
IFC Bad Function Parameter Counts Multiple Multiple |
PARSE.IFCBFPCMM |
|
IFC Bad Function Parameter Counts Multiple Single |
PARSE.IFCBFPCMS |
|
IFC Bad Function Parameter Counts Single Multiple |
PARSE.IFCBFPCSM |
|
IFC Bad Function Parameter Wrong Chart |
PARSE.IFCBFPWC |
|
Unsupported Header Unit Feature |
PARSE.UHUF |
|
volatile Increment/Decrement Deprecated |
PARSE.VIDD |
Replaced by two classes that distinguish the two operators: volatile Increment Deprecated (PARSE.VID) and volatile Decrement Deprecated (PARSE.VDD). |
Removed¶
Deleted Configuration File Parameters¶
The following configuration file parameters for CodeSonar for Binaries has been removed. Each is ignored if it is still present in an existing configuration file.
Deleted Parameter |
Notes |
|---|---|
|
Binary front-end options. |
|
|
|
|
|
|
|
|
|
|
|
Binary-analysis overrides of ordinary analysis options. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Binary and decompiler options. |
|
|
|
|
Anonymous Usage Statistics |
Upload for collected anonymous usage statistics is now always disabled |
Deleted API Functions¶
The following plug-in API entities, used only by binary analysis, have been removed.
Deleted |
Notes |
|---|---|
cs_language_is_machine_code() cs::language::is_machine_code() |
Machine-code languages are no longer supported. |
cs_ea cs::effective_address |
Effective-address type used only by binary analysis. |
cscm.ParseConfiguration.binaries_to_analyze cscm.ParseConfiguration.binaries_to_analyze_and_show cscm.ParseConfiguration.x86_flags_prepend cscm.ParseConfiguration.x86_flags_append |
Compiler-model plug-in binary options. |
cs.amc cs.amc_analysis cs.amc_context cs.amc_context_iterator cs.amc_context_iterator_mixin cs.amc_iterator cs.amc_iterator_mixin cs.amc_valuation cs.calling_context cs.value_set |
Python API classes for the abstract-memory-configuration, calling-context and value-set interfaces, all used only by binary analysis. |
cs.procedure_name_to_model_vector cs.string_pair cs.xtype_render_style |
Python API classes that are no longer generated, the only entry points taking or returning them having been removed with binary analysis. |
Warning Classes¶
New Warning Classes¶
Six of the eight new C/C++ warning classes are categorized under MISRA C++ 2023, and three under MISRA C 2023 and MISRA C 2025. Each warning class page lists every standard that the class is categorized under.
New Warning Classes |
Mnemonic |
|
|---|---|---|
C/C++ |
||
Discarded Explicit Type Conversion |
LANG.CAST.DISCARD |
|
Inappropriate Use of Enumeration Value |
LANG.TYPE.IUOEV |
|
Member Function Missing Ref-qualifier |
LANG.FUNCS.MFMRQ |
|
Multiple Uses of Condition Variable |
CONCURRENCY.LOCK.MUCV |
|
Negative Wide Character Value |
MISC.NEGWCHAR |
|
Smart Pointer Constructed From Raw Pointer |
LANG.FUNCS.SPRAWCTOR |
|
Struct or Union Implementation Not Hidden |
LANG.TYPE.NOTHIDDEN |
|
Use of Advanced Memory Management |
LANG.MEM.ADVANCED |
|
Java |
||
Potential Deadlock via Nested Synchronization (Java) |
JAVA.CONCURRENCY.LOCK.NESTED |
|
C# |
||
Potential Deadlock via Nested Synchronization (C#) |
CSHARP.CONCURRENCY.LOCK.NESTED |
The CERT-C mapping tables in CERT Checks and CERT Broad Mappings now list warning classes in separate columns for C and C++, and mark which CERT-C rules the SEI CERT C++ Coding Standard lists as also applying in C++.
The new Java and C# warning classes are disabled by default. The
Java class also applies to Kotlin code targeting the JVM when it is
analyzed with cs-java-scan.
Warning Class Changes¶
C/C++ Warning Classes¶
Modified C/C++ Warning Classes¶
Modified Class |
Changes |
|
|---|---|---|
Basic |
LANG.TYPE.BASIC |
Plain |
Numerical Type Used |
MISRA specifications. |
|
Missing |
LANG.STRUCT.MRS |
|
Return Statement |
reaching its closing brace as returning 0: C++, and C99 and
later. Under C90 the exit status is instead indeterminate, so
|
|
Object Defined |
LANG.STRUCT.DEF.ODH |
Inline variables (C++17) are now exempt. |
in Header File |
||
Missing |
LANG.STRUCT.PARENS |
Now correctly reported for an operand that is a compile-time |
Parentheses |
constant or one needing an implicit conversion. A C++
|
|
Use of |
LANG.STRUCT.EXCP.CATCH |
Now reports the enclosing procedure when the catch handler is |
catch |
inside one, matching the existing behavior of Use of throw. See Notes on Upgrading. |
|
Pointed-to Type |
LANG.TYPE.CBCONST |
False positives where something writes through a pointer or |
Could Be const |
reference stored into an aggregate member of
pointer-to-non- |
|
Member Function |
LANG.TYPE.MFCBCONST |
False positives where a member function modifies the object |
Could Be const |
through a |
|
Modification |
LANG.STRUCT.DECL.SNM |
A namespace-alias-definition written inside a function body |
of Standard Namespaces |
is no longer reported. Such an alias names nothing in the
enclosing namespace, so writing one in, for instance, an
out-of-line member of a |
Java Warning Classes¶
Modified Java Warning Classes¶
Modified Class |
Changes |
|
|---|---|---|
Double-Checked |
JAVA.CONCURRENCY.LOCK.DCL |
Now also mapped to CWE-543, in addition to CWE-366 and |
Locking (Java) |
CWE-609. |
Kotlin Warning Classes¶
The following existing warning classes now have corrected Kotlin language support, so that Kotlin source analyzed via cs-java-scan is checked consistently for these classes.
Modified Class |
Changes |
|
|---|---|---|
Password |
JAVA.HARDCODED.PASSWD.FILE |
Now also checked for Kotlin source (previously |
in Property File (Java) |
Java-only). |
|
Double-Checked |
JAVA.CONCURRENCY.LOCK.DCL |
Now also applies to Kotlin (previously Java and C# only), |
Locking (Java) |
including the common companion-object singleton idiom. |
Several other existing warning classes (Cross Site Scripting, Cross Site Scripting In Error Message Web Page, DOS Injection, Format String Injection, Inadequate Salt, Open Redirect, and Unsafe Base64 Encoding, all (Java)) gained Kotlin language support that remains disabled by default, matching their existing Java default.
Deleted Kotlin Warning Classes¶
Deleted Warning Class |
Mnemonic |
Notes |
|---|---|---|
Potential Deadlock via ReentrantLock (Kotlin) |
KOTLIN.CONCURRENCY.LOCK.NESTED.RL |
Subsumed by the new Potential Deadlock via Nested Synchronization (Java) warning class, which analyzes Kotlin-on-JVM bytecode. |
Potential Deadlock via Synchronized (Kotlin) |
KOTLIN.CONCURRENCY.LOCK.NESTED.SYNC |
Subsumed by the new Potential Deadlock via Nested Synchronization (Java) warning class, which analyzes Kotlin-on-JVM bytecode. |
Potentially Unsynchronised Singleton (Kotlin) |
KOTLIN.CONCURRENCY.SINGLETON |
Subsumed by the modified Double-Checked Locking (Java) warning class, which analyzes Kotlin-on-JVM bytecode. |
Configuration Parameters¶
No configuration parameters were added or removed in this release. The following existing parameters have changed.
Modified configuration parameters¶
Parameter |
Change |
|---|---|
|
Two new actions, |
|
The factory setting has a new entry, ^std:.*:_Fwd_list_node_base:. Uninitialized
Variable warnings are no longer issued for moved-from objects of
that libstdc++ type, which underlies std::forward_list. Analyses of C++ code that
moves from a |
API Changes¶
New API Result Codes¶
Two new cs_result codes:
CS_ERROR_IO_DELETE, set when a file cannot be deleted.
CS_ERROR_MALFORMED_PATCH_FILE, set when a patch file is not a well formed unified diff. See Source file patches.
AST Class Changes¶
New unnormalized C/C++ AST classes:
cc:ctp-dependent-constant, a template parameter constant that wraps a non-dependent constant to cause it to be treated as template-dependent.
cc:ctp-concat-string-literals.
cc:pack-index-expr, a pack indexing expression.
Modified unnormalized C/C++ AST classes:
cc:variablehas new :is-inline attributecc:vlahas new :sfid and :line attributescc:routine-typehas new :ref-qualifier attribute
Renamed and consolidated attributes. A plug-in that reads the old names must be updated.
cc:class-struct-unionreplaces :friend-routines and :friend-classes with a single :friends list, which also includes befriended templates.cc:variableattribute :is-parameter-pack is renamed :is-pack.
Plug-in Warning-Reporting API¶
The plug-in warning-reporting API can now attach warning annotations to a reported warning. Every warning-report entry point—the C functions csonar_report_warning() and its csonar_report_*_warning() siblings, and the corresponding cs::warningclass report() / report_return_warning() methods—now takes a list of annotations (cs_warning_annotation_t in C, cs::warning_annotation in C++).
Each annotation records a change to a warning report’s priority, state, finding, or owner, along with an author, a timestamp, and an optional comment. The annotations form a timeline of report changes and appear as separate entries in the warning’s change history in the hub GUI. Passing an empty list leaves the report unchanged.
Plug-in AST Traversal Example¶
The Python astchecker.py module, shipped as an unsupported example, has been improved. It now runs much faster, avoiding redundant work as it traverses the AST. A plug-in that used it to match normalized ASTs must register those matchers with the new add_nast_matcher() rather than add_matcher().
Hub HTTP API¶
When editing a project, project tree, launchd group, or role through the hub HTTP API, the old_field_hash request fields are now optional, as they already were on the analysis-editing endpoints. A client that omits them overwrites whatever is stored.
Configuration Tool¶
When codesonar config is used to enable the hub
cluster’s analysis cloud, it now also enables distributed parsing
(REQUEST_REMOTE_PARSE_SLAVES) alongside distributed analysis
(REQUEST_REMOTE_ANALYSIS_SLAVES), and applies the chosen
analysis-parallelism level to PARSE_SLAVES as well as
ANALYSIS_SLAVES. Previously, the parse-phase options were
left at their defaults, so parsing was never distributed to the
analysis cloud, and the chosen parallelism level did not apply to the
parse phase.
Docker Image Build¶
The Dockerfile.in template used to build a CodeSonar analysis Docker image now accepts a CSO_SRC build argument. Set it to the relative path, from the Docker build context root, of the CodeSonar installation being packaged. This lets the CodeSonar installation live in a subdirectory of the build context alongside the rest of your compiler toolchain, instead of requiring it to sit at the context root.
Customer Tickets Fixed¶
NAME |
NUMBER |
NOTES |
|---|---|---|
False positive “Pointed-to Type Could Be const” (LANG.TYPE.CBCONST) and “Member Function Could Be const” (LANG.TYPE.MFCBCONST) warnings in C++ code that uses lambdas, and in C or C++ code that initializes an aggregate from a pointer. In exchange, false negatives: those constructs are no longer reported even where the report would be correct. See Modified C/C++ Warning Classes . |
#7434, CS0042416 |
fixed |
An analysis using the |
#7449, CS0042646 |
fixed |
On Windows, an MCP tool call such as list_warnings could deadlock and never return. |
#7409, CS0043069 |
fixed |
False positive Data Race warnings for accesses protected
by FreeRTOS |
#7453, CS0043306 |
fixed |
Requesting cloud-analysis or remote parse slaves could fail
with an internal server error ( |
#7285, CS0043123 |
fixed |
In C++ code that declares a |
#7263 |
fixed |
False positive |
#7181, CS0042973 |
fixed |
False positive |
#7129, CS0042877 |
fixed |
Kotlin analysis via |
#7276, CS0043032 |
fixed |
Analysis could abort with an internal error when the
|
#7316 |
fixed |
False negative |
#7347 |
fixed |
Analysis could abort with an internal error when parsing a C++ class that inherits an overloaded assignment operator via a using-declaration from a dependent base class. |
#7383, CS0042952 |
fixed |
The C/C++ front end could crash on a class template instance
one of whose constructors has a C++20 trailing
|
#7396, CS0043205 |
fixed |
On Windows, an analysis using |
#7327, CS0043129 |
fixed |
False positive |
#7446, CS0043028 |
fixed |
|
#7480 |
fixed |
False positive Unreasonable Size Argument warning on a
fortified string or memory call ( |
#7146, CS0042689 |
fixed |
Parsing Qt headers with an ARM GCC compiler model could fail
with |
#7235, CS0043024 |
fixed |
False positive Missing Return Statement (LANG.STRUCT.MRS)
warning for |
#7239, CS0042416 |
fixed |
The |
#7249, CS0043048 |
fixed |
The MCP server now always runs analyses with
|
#7278, CS0043069 |
fixed |
When an automatic processor failed to start, the hub log
recorded an |
#7282, CS0043128 |
fixed |
On Windows, |
#7288, CS0043069 |
fixed |
The |
#7326, CS0043196 |
fixed |
Renaming hub roles, or adding or removing a role across many users, could be done only one user at a time in the GUI or by calling the hub HTTP API directly. The new codesonar rename_roles.py and codesonar set_user_roles.py subcommands do both from a CSV file. |
#7341, CS0042511 |
fixed |
Enabling Modification of Standard Namespaces (LANG.STRUCT.DECL.SNM) or Use of catch (LANG.STRUCT.EXCP.CATCH) made analysis very slow on heavily templated C++ code, such as code that uses Eigen3. |
#7382, CS0042952 |
fixed |
The manual did not describe how to upgrade a hub running in the CodeSonar Hub Docker image. |
#7432, CS0043200 |
fixed |
CodeSonar for C/C++ Release 27.0: Release Notes¶
Notes on Upgrading¶
The minimum CodeSonar version for a direct upgrade to CodeSonar 27.0 or later is 7.2p0. If you have a hub that is running CodeSonar 7.1p0 or earlier, contact CodeSonar support for assistance in upgrading.
If you have made changes to any of your CodeSonar configuration files, you must upgrade those files as part of the upgrade process, and for some of them the procedure includes steps that must be carried out before CodeSonar is upgraded.
See MANUAL: Upgrading Configuration Files for instructions.
If you are upgrading a CodeSonar installation that will be used by someone else:
Determine the most appropriate person to upgrade the general template and compiler template configuration files. This will depend on local factors such as who usually makes changes to these files.
CodeSonar for Binaries has been baselined: CodeSonar 9.2 was its final release. Use CodeSonar 9.2 to perform binary analyses going forward.
The ``codesonar activate`` subcommand has been removed. It is no longer needed.
CodeSecure, Inc. has merged into AdaCore, and product branding has changed accordingly. Points to note when upgrading:
On Windows, the default installation directory is now
...\AdaCore\CodeSonar, and the installer records its settings under the Software\AdaCore\CodeSonar registry key. The installer will detect an existing CodeSecure-era or GrammaTech-era installation and offer to uninstall it.The Java plugin API package has been renamed from com.codesecure.cs to com.codesonar.cs; update import statements in Java plugin sources.
The C API function cs_codesecure_home_directory() has been renamed cs_install_directory().
Windows device-driver installation has moved from hookcs.exe to codesonar. hookcs.exe –install and –uninstall no longer exist; use codesonar uninstall-driver and codesonar install-driver instead. Scripts
that follow the instructions given in the 3.5 and 3.6 release notes
must be updated: where those notes gave the single invocation
hookcs.exe --uninstall --install,
the replacement is two commands, and the uninstall must come first —
installing over an existing registration leaves the registered driver
in place.
The new subcommands exist on every platform and succeed without doing anything where there is no driver, so a portable script need not test the platform.
Configuration files that are not encoded in UTF-8 are now diagnosed. CodeSonar has always treated configuration file text as UTF-8, but ill-formed bytes were passed through silently. Such a file now raises a Bad Configuration File Setting alert, naming the file and the first line on which invalid bytes appear, and every line containing those bytes is ignored rather than used — so a setting that previously took effect by accident will no longer do so. Plain ASCII is UTF-8, so only configuration files holding non-English text are affected; re-save any such file as UTF-8. A byte-order mark at the start of a configuration file is now ignored instead of being taken as part of the first parameter name. See File encoding.
If you have previously installed the CodeSonar plug-in for Visual Studio or CodeSonar plug-in for Eclipse, upgrade those installations after upgrading CodeSonar.
Existing “Use of catch” warnings get a new fingerprint on upgrade. The warning now includes the enclosing procedure where one exists (see Warning Class Changes), and procedure identity is part of the fingerprint, so most existing “Use of catch” warnings are re-keyed as new findings. Triage state attached to the old fingerprint (assigned, annotated, or marked expected) does not carry over to the new one.
Source file patches from one directory are now applied in ascending order of patch file name, compared byte by byte. Where two patches apply to the same region of a file, the result no longer varies between machines or locales.
The header patch for arm_neon.h as shipped with GCC 9.3 is now applied. Analyses of ARM code built with GCC 9.3 may report differently.
A ``std::vector`` built from a braced initializer list now has a known size. The header patch for libstdc++’s bits/stl_vector.h has been updated. Analyses of C++ code that constructs vectors this way may report differently: overruns of the vector’s storage that were previously missed are now reported, and null pointer dereferences of data() are not.
Missing Parentheses (LANG.STRUCT.PARENS) now reports operands it previously missed. An operand that is a compile-time constant, or that needs an implicit conversion, is now reported. A project that enables this class may therefore see new warnings after upgrading, on code that has not changed. Every MISRA, AUTOSAR, CERT C, and JPL preset that maps this class enables it.
What’s New¶
Version Numbering |
Versions are now year.point with no patch component, so this release is 27.0 rather than a successor to 9.2. Within a year, .0 is the Initial Release for early evaluation, .1 the Production Release for commercial deployment and .2 the Corrective Release for bug fixes and maintenance. Wavefronts and continuous releases, available on request to carry a fix or feature ahead of the next release, carry a suffix such as 27.0w. |
A new edition that analyzes Ada using a bundled GNAT SAS engine. See MANUAL: Build and Analysis for Ada Projects. |
|
The bundled EDG C/C++ front end has been updated from version 6.7 to version 6.9, broadening language coverage, improving compiler compatibility, and fixing code that previously failed to parse. |
|
AdaCore Branding |
CodeSecure, Inc. has merged into AdaCore. Product branding, installer metadata, documentation, and support contact points now refer to AdaCore. See Notes on Upgrading for renamed installation paths and API packages. |
Default HTTP Session Timeout |
The default HTTP session timeout for newly created hubs is now 60 minutes (previously 15 minutes). You can change this setting on the HTTP tab of the Admin Settings page. Existing hubs are not affected. |
There are modified warning classes for C/C++ and Java, a new Java warning class, and deleted Kotlin warning classes. |
|
Visual C++ Standard Library Models |
Analysis of code built with Visual C++ 2010 or Visual C++ 2015 (before Update 3) no longer reports spurious uninitialized-variable warnings on copies of a default-constructed std::istreambuf_iterator. |
Use of catch / Modification of Standard Namespaces Performance |
Analysis using the “Use of catch” (LANG.STRUCT.EXCP.CATCH) or “Modification of Standard Namespaces” (LANG.STRUCT.DECL.SNM) warning classes was previously very slow. The performance of both has been improved. |
There are some changes to C/C++ ASTs, and the plug-in API can now attach annotations to reported warnings. |
|
codesonar rename_roles.py |
This is a new |
codesonar set_user_roles.py |
This is a new |
MCP Server Configuration Control |
The CodeSonar MCP server can now restrict the AI agent’s analyses to a project directory you nominate, and its configuration files to directories you permit, using –project-dir and –conf-dir. –allow-build-command approves a build command in advance, which an agent whose client cannot be prompted requires in order to run an analysis at all. See MANUAL: What These Options Control. |
Bundled curl |
CodeSonar now uses curl 8.21.0, which picks up the fixes for the security advisories published against the 8.14.1 it replaces. Separately, the bundled curl is now built with support for HTTP and HTTPS only; the other protocols it used to carry, and NTLM authentication, are no longer compiled in, so advisories against those protocols no longer apply to the bundled build whether or not upstream has fixed them. |
MCP Progress Reporting |
The CodeSonar MCP server now reports progress while a CodeSonar command it spawned is running, so a client that asks for progress is told the work is continuing. Clients commonly abandon a tool call that has said nothing for long enough, which could end a long analysis or a large warning listing before it finished. |
|
|
Details¶
CodeSonar for Ada¶
CodeSonar analyzes Ada using GNAT SAS, AdaCore’s static analysis tool for Ada. A CodeSonar
for Ada installation bundles it, so no separate installation is
needed.
To include an Ada component, extend your CodeSonar-facing
build with one or more invocations of codesonar ada_scan.py, naming the GNAT
Project file (.gpr) to analyze, then
run the build/analysis as usual.
You do not need to build the project with gprbuild, or to observe any Ada compilation step, in order to analyze it.
codesonar ada_scan.py takes the project file rather than a list of source files. The Ada source files are derived from the project itself, together with the runtime and library units it refers to; the naming rules in the project’s
Namingpackage are honored.GNAT SAS warnings are exported in SARIF and imported into the CodeSonar project. Each GNAT SAS check corresponds to one of CodeSonar’s built-in Ada warning classes.
An Ada parser program, run alongside GNAT SAS, supplies procedure information and cross-references, which populate the Procedures tab and the cross-reference and code-search navigation.
CodeSonar for Ada carries no C or C++, Java or C# analyzers, and no Windows build wizard, plug-in for Eclipse or plug-in for Visual Studio. Use Build and Analysis for Ada Projects, which is a command-line workflow. The tier 3 scanners — Go, JavaScript, Python, and Rust — are unaffected.
One consequence of moving a configuration or a script from
another edition: the java and
dotnet compiler models
are not registered, and naming one reports which edition provides it
rather than reporting it as unknown.
CodeSonar for Ada does not require a license key: there is none to obtain, install, or renew. The configuration tool omits its Generate a license entry, and the License Key Utilization page omits its Request a new license key link.
Analyzing a project that contains both C/C++ and Ada requires a
CodeSonar for C/C++ installation, as CodeSonar for Ada does not
include the C/C++ front end. Run the build/analysis from the C/C++
installation. It bundles no gnatsas, so codesonar ada_scan.py looks for one on
PATH; put the gnatsas/bin directory of your CodeSonar for Ada
installation there, or name the program with -gnatsas.
C/C++ Parser Upgrade¶
The bundled EDG C/C++ front end has been updated from version 6.7 to version 6.9, spanning two upstream releases. This broadens language coverage, improves compiler compatibility, and fixes code that previously failed to parse.
Constructs that previously provoked a generic parse error are now diagnosed specifically. The new parser warning classes name the features involved, among them C++20 alias template deduction, the C++23 explicit object parameter, C++26 structured binding packs, and the C23
#embeddirective and_BitInttypes.Header patches that existed only to work around parser limitations have been removed where the parser now handles the construct itself. For example, the patches supplying a
__fp16typedef are gone, because the parser now supports__fp16directly in GCC mode. See Customer Tickets Fixed.
New C/C++ parser warning classes¶
There are many new warning classes corresponding to C/C++ parser warnings and parser errors. For a full list, see C/C++ Parser Warning Classes.
As with the existing parser warning classes, these are enabled by
default for C and C++, and a factory setting for WARNING_FILTER discards warning instances that
correspond to parser errors, so errors from the parse log are not duplicated as
CodeSonar warnings.
Deleted C/C++ parser warning classes¶
The following warning classes have been removed because the
underlying parser diagnostics no longer exist. A WARNING_FILTER rule naming one of these mnemonics
no longer matches anything.
Deleted Warning Class |
Mnemonic |
Notes |
|---|---|---|
Header Unit Creation Failure |
PARSE.HUCF |
|
IFC Bad Function Definition |
PARSE.IFCBFD |
|
IFC Bad Function Parameter Counts Multiple Multiple |
PARSE.IFCBFPCMM |
|
IFC Bad Function Parameter Counts Multiple Single |
PARSE.IFCBFPCMS |
|
IFC Bad Function Parameter Counts Single Multiple |
PARSE.IFCBFPCSM |
|
IFC Bad Function Parameter Wrong Chart |
PARSE.IFCBFPWC |
|
Unsupported Header Unit Feature |
PARSE.UHUF |
|
volatile Increment/Decrement Deprecated |
PARSE.VIDD |
Replaced by two classes that distinguish the two operators: volatile Increment Deprecated (PARSE.VID) and volatile Decrement Deprecated (PARSE.VDD). |
Removed¶
Deleted Configuration File Parameters¶
The following configuration file parameters for CodeSonar for Binaries has been removed. Each is ignored if it is still present in an existing configuration file.
Deleted Parameter |
Notes |
|---|---|
|
Binary front-end options. |
|
|
|
|
|
|
|
|
|
|
|
Binary-analysis overrides of ordinary analysis options. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Binary and decompiler options. |
|
|
|
|
Anonymous Usage Statistics |
Upload for collected anonymous usage statistics is now always disabled |
Deleted API Functions¶
The following plug-in API entities, used only by binary analysis, have been removed.
Deleted |
Notes |
|---|---|
cs_language_is_machine_code() cs::language::is_machine_code() |
Machine-code languages are no longer supported. |
cs_ea cs::effective_address |
Effective-address type used only by binary analysis. |
cscm.ParseConfiguration.binaries_to_analyze cscm.ParseConfiguration.binaries_to_analyze_and_show cscm.ParseConfiguration.x86_flags_prepend cscm.ParseConfiguration.x86_flags_append |
Compiler-model plug-in binary options. |
cs.amc cs.amc_analysis cs.amc_context cs.amc_context_iterator cs.amc_context_iterator_mixin cs.amc_iterator cs.amc_iterator_mixin cs.amc_valuation cs.calling_context cs.value_set |
Python API classes for the abstract-memory-configuration, calling-context and value-set interfaces, all used only by binary analysis. |
cs.procedure_name_to_model_vector cs.string_pair cs.xtype_render_style |
Python API classes that are no longer generated, the only entry points taking or returning them having been removed with binary analysis. |
Warning Classes¶
New Warning Classes¶
Six of the eight new C/C++ warning classes are categorized under MISRA C++ 2023, and three under MISRA C 2023 and MISRA C 2025. Each warning class page lists every standard that the class is categorized under.
New Warning Classes |
Mnemonic |
|
|---|---|---|
C/C++ |
||
Discarded Explicit Type Conversion |
LANG.CAST.DISCARD |
|
Inappropriate Use of Enumeration Value |
LANG.TYPE.IUOEV |
|
Member Function Missing Ref-qualifier |
LANG.FUNCS.MFMRQ |
|
Multiple Uses of Condition Variable |
CONCURRENCY.LOCK.MUCV |
|
Negative Wide Character Value |
MISC.NEGWCHAR |
|
Smart Pointer Constructed From Raw Pointer |
LANG.FUNCS.SPRAWCTOR |
|
Struct or Union Implementation Not Hidden |
LANG.TYPE.NOTHIDDEN |
|
Use of Advanced Memory Management |
LANG.MEM.ADVANCED |
|
Java |
||
Potential Deadlock via Nested Synchronization (Java) |
JAVA.CONCURRENCY.LOCK.NESTED |
|
C# |
||
Potential Deadlock via Nested Synchronization (C#) |
CSHARP.CONCURRENCY.LOCK.NESTED |
The CERT-C mapping tables in CERT Checks and CERT Broad Mappings now list warning classes in separate columns for C and C++, and mark which CERT-C rules the SEI CERT C++ Coding Standard lists as also applying in C++.
The new Java and C# warning classes are disabled by default. The
Java class also applies to Kotlin code targeting the JVM when it is
analyzed with cs-java-scan.
Warning Class Changes¶
C/C++ Warning Classes¶
Modified C/C++ Warning Classes¶
Modified Class |
Changes |
|
|---|---|---|
Basic |
LANG.TYPE.BASIC |
Plain |
Numerical Type Used |
MISRA specifications. |
|
Missing |
LANG.STRUCT.MRS |
|
Return Statement |
reaching its closing brace as returning 0: C++, and C99 and
later. Under C90 the exit status is instead indeterminate, so
|
|
Object Defined |
LANG.STRUCT.DEF.ODH |
Inline variables (C++17) are now exempt. |
in Header File |
||
Missing |
LANG.STRUCT.PARENS |
Now correctly reported for an operand that is a compile-time |
Parentheses |
constant or one needing an implicit conversion. A C++
|
|
Use of |
LANG.STRUCT.EXCP.CATCH |
Now reports the enclosing procedure when the catch handler is |
catch |
inside one, matching the existing behavior of Use of throw. See Notes on Upgrading. |
|
Pointed-to Type |
LANG.TYPE.CBCONST |
False positives where something writes through a pointer or |
Could Be const |
reference stored into an aggregate member of
pointer-to-non- |
|
Member Function |
LANG.TYPE.MFCBCONST |
False positives where a member function modifies the object |
Could Be const |
through a |
|
Modification |
LANG.STRUCT.DECL.SNM |
A namespace-alias-definition written inside a function body |
of Standard Namespaces |
is no longer reported. Such an alias names nothing in the
enclosing namespace, so writing one in, for instance, an
out-of-line member of a |
Java Warning Classes¶
Modified Java Warning Classes¶
Modified Class |
Changes |
|
|---|---|---|
Double-Checked |
JAVA.CONCURRENCY.LOCK.DCL |
Now also mapped to CWE-543, in addition to CWE-366 and |
Locking (Java) |
CWE-609. |
Kotlin Warning Classes¶
The following existing warning classes now have corrected Kotlin language support, so that Kotlin source analyzed via cs-java-scan is checked consistently for these classes.
Modified Class |
Changes |
|
|---|---|---|
Password |
JAVA.HARDCODED.PASSWD.FILE |
Now also checked for Kotlin source (previously |
in Property File (Java) |
Java-only). |
|
Double-Checked |
JAVA.CONCURRENCY.LOCK.DCL |
Now also applies to Kotlin (previously Java and C# only), |
Locking (Java) |
including the common companion-object singleton idiom. |
Several other existing warning classes (Cross Site Scripting, Cross Site Scripting In Error Message Web Page, DOS Injection, Format String Injection, Inadequate Salt, Open Redirect, and Unsafe Base64 Encoding, all (Java)) gained Kotlin language support that remains disabled by default, matching their existing Java default.
Deleted Kotlin Warning Classes¶
Deleted Warning Class |
Mnemonic |
Notes |
|---|---|---|
Potential Deadlock via ReentrantLock (Kotlin) |
KOTLIN.CONCURRENCY.LOCK.NESTED.RL |
Subsumed by the new Potential Deadlock via Nested Synchronization (Java) warning class, which analyzes Kotlin-on-JVM bytecode. |
Potential Deadlock via Synchronized (Kotlin) |
KOTLIN.CONCURRENCY.LOCK.NESTED.SYNC |
Subsumed by the new Potential Deadlock via Nested Synchronization (Java) warning class, which analyzes Kotlin-on-JVM bytecode. |
Potentially Unsynchronised Singleton (Kotlin) |
KOTLIN.CONCURRENCY.SINGLETON |
Subsumed by the modified Double-Checked Locking (Java) warning class, which analyzes Kotlin-on-JVM bytecode. |
Configuration Parameters¶
No configuration parameters were added or removed in this release. The following existing parameters have changed.
Modified configuration parameters¶
Parameter |
Change |
|---|---|
|
Two new actions, |
|
The factory setting has a new entry, ^std:.*:_Fwd_list_node_base:. Uninitialized
Variable warnings are no longer issued for moved-from objects of
that libstdc++ type, which underlies std::forward_list. Analyses of C++ code that
moves from a |
API Changes¶
New API Result Codes¶
Two new cs_result codes:
CS_ERROR_IO_DELETE, set when a file cannot be deleted.
CS_ERROR_MALFORMED_PATCH_FILE, set when a patch file is not a well formed unified diff. See Source file patches.
AST Class Changes¶
New unnormalized C/C++ AST classes:
cc:ctp-dependent-constant, a template parameter constant that wraps a non-dependent constant to cause it to be treated as template-dependent.
cc:ctp-concat-string-literals.
cc:pack-index-expr, a pack indexing expression.
Modified unnormalized C/C++ AST classes:
cc:variablehas new :is-inline attributecc:vlahas new :sfid and :line attributescc:routine-typehas new :ref-qualifier attribute
Renamed and consolidated attributes. A plug-in that reads the old names must be updated.
cc:class-struct-unionreplaces :friend-routines and :friend-classes with a single :friends list, which also includes befriended templates.cc:variableattribute :is-parameter-pack is renamed :is-pack.
Plug-in Warning-Reporting API¶
The plug-in warning-reporting API can now attach warning annotations to a reported warning. Every warning-report entry point—the C functions csonar_report_warning() and its csonar_report_*_warning() siblings, and the corresponding cs::warningclass report() / report_return_warning() methods—now takes a list of annotations (cs_warning_annotation_t in C, cs::warning_annotation in C++).
Each annotation records a change to a warning report’s priority, state, finding, or owner, along with an author, a timestamp, and an optional comment. The annotations form a timeline of report changes and appear as separate entries in the warning’s change history in the hub GUI. Passing an empty list leaves the report unchanged.
Plug-in AST Traversal Example¶
The Python astchecker.py module, shipped as an unsupported example, has been improved. It now runs much faster, avoiding redundant work as it traverses the AST. A plug-in that used it to match normalized ASTs must register those matchers with the new add_nast_matcher() rather than add_matcher().
Hub HTTP API¶
When editing a project, project tree, launchd group, or role through the hub HTTP API, the old_field_hash request fields are now optional, as they already were on the analysis-editing endpoints. A client that omits them overwrites whatever is stored.
Configuration Tool¶
When codesonar config is used to enable the hub
cluster’s analysis cloud, it now also enables distributed parsing
(REQUEST_REMOTE_PARSE_SLAVES) alongside distributed analysis
(REQUEST_REMOTE_ANALYSIS_SLAVES), and applies the chosen
analysis-parallelism level to PARSE_SLAVES as well as
ANALYSIS_SLAVES. Previously, the parse-phase options were
left at their defaults, so parsing was never distributed to the
analysis cloud, and the chosen parallelism level did not apply to the
parse phase.
Docker Image Build¶
The Dockerfile.in template used to build a CodeSonar analysis Docker image now accepts a CSO_SRC build argument. Set it to the relative path, from the Docker build context root, of the CodeSonar installation being packaged. This lets the CodeSonar installation live in a subdirectory of the build context alongside the rest of your compiler toolchain, instead of requiring it to sit at the context root.
Customer Tickets Fixed¶
NAME |
NUMBER |
NOTES |
|---|---|---|
False positive “Pointed-to Type Could Be const” (LANG.TYPE.CBCONST) and “Member Function Could Be const” (LANG.TYPE.MFCBCONST) warnings in C++ code that uses lambdas, and in C or C++ code that initializes an aggregate from a pointer. In exchange, false negatives: those constructs are no longer reported even where the report would be correct. See Modified C/C++ Warning Classes . |
#7434, CS0042416 |
fixed |
An analysis using the |
#7449, CS0042646 |
fixed |
On Windows, an MCP tool call such as list_warnings could deadlock and never return. |
#7409, CS0043069 |
fixed |
False positive Data Race warnings for accesses protected
by FreeRTOS |
#7453, CS0043306 |
fixed |
Requesting cloud-analysis or remote parse slaves could fail
with an internal server error ( |
#7285, CS0043123 |
fixed |
In C++ code that declares a |
#7263 |
fixed |
False positive |
#7181, CS0042973 |
fixed |
False positive |
#7129, CS0042877 |
fixed |
Kotlin analysis via |
#7276, CS0043032 |
fixed |
Analysis could abort with an internal error when the
|
#7316 |
fixed |
False negative |
#7347 |
fixed |
Analysis could abort with an internal error when parsing a C++ class that inherits an overloaded assignment operator via a using-declaration from a dependent base class. |
#7383, CS0042952 |
fixed |
The C/C++ front end could crash on a class template instance
one of whose constructors has a C++20 trailing
|
#7396, CS0043205 |
fixed |
On Windows, an analysis using |
#7327, CS0043129 |
fixed |
False positive |
#7446, CS0043028 |
fixed |
|
#7480 |
fixed |
False positive Unreasonable Size Argument warning on a
fortified string or memory call ( |
#7146, CS0042689 |
fixed |
Parsing Qt headers with an ARM GCC compiler model could fail
with |
#7235, CS0043024 |
fixed |
False positive Missing Return Statement (LANG.STRUCT.MRS)
warning for |
#7239, CS0042416 |
fixed |
The |
#7249, CS0043048 |
fixed |
The MCP server now always runs analyses with
|
#7278, CS0043069 |
fixed |
When an automatic processor failed to start, the hub log
recorded an |
#7282, CS0043128 |
fixed |
On Windows, |
#7288, CS0043069 |
fixed |
The |
#7326, CS0043196 |
fixed |
Renaming hub roles, or adding or removing a role across many users, could be done only one user at a time in the GUI or by calling the hub HTTP API directly. The new codesonar rename_roles.py and codesonar set_user_roles.py subcommands do both from a CSV file. |
#7341, CS0042511 |
fixed |
Enabling Modification of Standard Namespaces (LANG.STRUCT.DECL.SNM) or Use of catch (LANG.STRUCT.EXCP.CATCH) made analysis very slow on heavily templated C++ code, such as code that uses Eigen3. |
#7382, CS0042952 |
fixed |
The manual did not describe how to upgrade a hub running in the CodeSonar Hub Docker image. |
#7432, CS0043200 |
fixed |
GNAT SAS 27 Release Notes¶
We present the Release Notes for GNAT SAS for users who run gnatsas directly or via automation, rather than analyzing with CodeSonar for Ada. For more information about CodeSonar for Ada, see its dedicated release note. You can access the complete list in the CodeSonar for Ada feature file.
GNATcheck Rules¶
Symmetry in ‘Nested_paths’ Rule¶
The GNATcheck ‘Nested_Paths’ rule now tries to preserve the if-else branch symmetry, meaning that paths won’t be flagged when both contain a breaking statement of the same kind.
Raising_External_Exceptions Fix¶
The Raising_External_Exceptions rule has been enhanced to correctly
exclude exceptions that are raised and caught within the same scope. The
rule now only flags exceptions that can actually propagate externally,
eliminating false positives for internally handled exceptions.
Location for a Non-printable ASCII Character¶
GNATcheck now reports precise line and column numbers when flagging code blocks that contain a non-printable ASCII character, pointing directly to the invisible character.
Deprecation of stdlib.is_limited_type¶
The is_limited_type() function from the LKQL standard library has been deprecated in favor of the Libadalang property p_is_limited_type.
For example, a call of the form:
stdlib.is_limited_type(type)
can be rewritten as:
type.p_is_limited_type()
The stdlib function will be removed in the next release of GNATcheck. The expected type of type remains unchanged: it’s a BaseTypeDecl.
New Rule for out_parameter_read_in_exception_handler¶
A new checker (out_parameter_read_in_exception_handler) has been added to the GNATcheck predefined set of rules, allowing users to detect mode-out parameters that are read within an exception handler. This helps identify potential read-before-update issues where the write operation may not have occurred.
LKQL Language¶
New version of the Language¶
A new version of LKQL is now available as a beta. LKQL V2 introduces significant improvements to the language and its development tools:
Revised syntax: A redesigned syntax with new types and simplified language constructs, including streams replacing selectors.
Static type system: Type checking detects errors before execution, improving code reliability and maintainability. Type checking can be configured in warning, strict, or disabled mode.
Improved IDE integration: A new VS Code extension and LKQL Language Server provide syntax highlighting, code completion, navigation, symbol renaming, and syntactic and semantic diagnostics.
A migration tool is also available to help convert existing LKQL V1 code to V2.
Libadalang API documentation for the LKQL language¶
LKQL documentation now contains a section about the Libadalang API that describes node types and properties available from the LKQL language.
Analysis engines¶
Quick Fixes for GNATcheck Rules¶
GNATcheck can suggest a possible remediation for style violations. If you agree with the suggestion, apply it to your code. This new feature can be accessed via an agentic workflow, or you can work interactively in GNAT Studio or VSCode.
Report GNATcheck Findings in SARIF¶
Export GNATcheck findings in the Static Analysis Results Interchange Format (SARIF). This industry standard allows static analysis tools It is easier to exchange findings with other tools.
Increase Inspector Phi Completion Passes¶
As part of its analysis, Inspector uses a Static Single Assignment (SSA) representation, which uses “phi” nodes to keep track of values that are assigned on multiple paths incoming to a basic block. To avoid possible excessive computation, Inspector limited the number of passes over the control-flow graph of a subprogram to three when iterating to create and initialize phi nodes. In some complex situations, this prior limit of three seems to be inadequate. Therefore, we have increased this limit to six, which should allow certain complex subprograms to be analyzed that before would run into a tool limitation.
Add the Possibility to Deactivate Taint Analysis¶
You may now choose to completely deactivate taint analysis by adding the ‘–no-taint’ switch to the ‘gnatsas analyze’ command.
Improved Robustness for Access and Array Types¶
GNAT SAS is now more robust when the Ada front end produces objects with incorrect type information. In some edge cases, a non-access type could be used in an access dereference or array indexing context, potentially causing the analysis to crash or produce incorrect results. GNAT SAS now handles such cases gracefully and continues the analysis.
Extend Type State API Annotations¶
Type state analysis now adds support for
ada.text_io.{put|get|look_ahead|get_immediate}
ada.text_io.integer_io.{put|get}
More Informative Messages¶
Better Messages about Functions with Side Effects¶
The messages about functions with side effects and functions with side effects in conditionals now include the modified variables.
Better error message on generic instances¶
Inspector now mentions the locations of the instances that trigger a check that fails inside a generic body. A generic instantiated inside another generic gives a chain, innermost first. This new information is reported in the following formats:
text (under –show-backtraces): one line per instance.
SARIF: one relatedLocation per instance, tied to the result’s own location by an isIncludedBy relationship, and named in the message — as embedded links in the markdown variant, plainly in text.
GNAT Studio: one backtrace frame per instance, after the message’s own backtrace and at the level of its roots.
User interface¶
Complete support of GPR standard switches¶
GNAT SAS now supports standard gprbuild project-specific switches, namely: ‘-aP’, ‘–autoconf’, ‘–config’, ‘–db’, ‘–db-‘, ‘–implicit-with’, ‘-el’, ‘–print-gpr-registry’, ‘–root-dir’, ‘–relocate-build-tree’, ‘–RTS’, ‘–src-subdirs’, ‘–target’.
More descriptive –show-header output¶
GNAT SAS’s –show-header text output now displays a more precise version of the analysis host’s version (e.g., “Ubuntu 22.04”) if possible, along with its hostname and the amount of time spent analyzing code.
Recovering from Windows filesystem errors¶
GNAT SAS is now able to recover from some errors related to file paths being too long on Windows. When these errors happen, a warning is printed along with advice detailing workarounds instead of stopping GNAT SAS’s execution.
Libadalang 27 Release Notes¶
We present here a few highlights of the new features in Libadalang 27. You can access the complete list in the Libadalang 27 feature file.
Static expression evaluator¶
Support evaluation of 'Range_Length¶
The static expression evaluator now supports the Range_Length attribute.
Support evaluation of 'Width on discerte types¶
Libadalang’s expression evaluator now supports evaluation of the ‘Width attribute. This initial support is limited to discrete types.
Support evaluation of 'Size on standard types¶
This improvement in Libadalang’s expression evaluator allows it to evaluate expressions that involve occurrences of the ‘Size attribute, when applied to predefined types from the Standard package (Boolean, Integer, etc.).
Support evaluation of 'First/'Last/'Length on arrays¶
This improvement in Libadalang’s expression evaluator allows it to evaluate expressions that contain occurrences of the ‘First, ‘Last or ‘Length attributes applied to statically constrained arrays.
New properties¶
New property is_statically_predicated¶
This property can be used to determine whether a static predicate
applies to the given type. The static predicate can be defined either by
a Static_Predicate aspect or by a Predicate pragma whose
expression is static.
New property is_nameres_ambiguous¶
This new property allows querying whether multiple semantic interpretations are possible for a given resolution context, for example if the name of a call expression can designate two different semantically valid subprograms.
New property corresponding_neq_subprogram¶
Return the corresponding "/=" synthesized subprogram of a "="
subprogram.
This property should only be called on a subprogram with the name
"=", otherwise a PreconditionFailure will be raised.
New property discrete_static_values¶
If applicable, return the values that this discrete subtype can take as an array of concrete ranges, by taking into account static predicates that apply to this subtype.
New property is_classwide¶
A new property is_classwide has been added that returns whether a type is a class-wide type.
Improvements¶
Support of recent SPARK features¶
Libadalang’s syntactic and semantic support for the SPARK subset was updated to include:
Multiple levels of ghost code
The
InitializesaspectThe
Exceptional_CasesandExit_CasesaspectsThe
Modifiesaspect
Robustness to incremental changes¶
Libadalang’s lexical environments were made more robust to incremental changes (e.g. re-analyzing a unit after it was edited and reparsed), fixing latent issues where cache invalidation could be missed in certain circumstances (which could lead to invalid name resolution).
Partial reformatting of rewritten source sections¶
Libadalang’s rewriting API now allows applying the edit such that it will be formatted using a provided unparsing configuration, without impacting the existing formatting of the sources for sections that were not modified.
Unparsing¶
General branching constructs¶
The unparsing DSL was extended to support a small subset of expressions
(comparisons, invoking node properties, etc.) and a generic constructs, instead
of the previous hard-wired ifEmpty and ifKind constructs. This allows
much more flexibility in describing how formatting must apply under specific
contexts.
Allow overridings of the unparsing config¶
The unparsing API for loading an unparsing configuration now allows users to pass extra partial configurations that can override parts of the base configuration, in order to ease customization: users can re-define how a specific node is formatted without having to provide an entire unparsing configuration.
API breaking changes¶
Op node is not a token node anymore¶
The Op node kind was previously declared as deriving from the
SingleTokNode kind (itself deriving from Name), but this was
unnecessary, as the symbol of an operator can always be determined by its kind
(e.g. OpAnd’s symbol is and), meaning it’s useless to store with it
the source string that was used to parse it. But it was also wrong, as some
operators are actually composed of multiple tokens (e.g. OpAndThen).
Thus, Op was modified to derive directly from Name, and property
signatures impacted by this change were adapted accordingly.
- orphan:
SPARK 27 Release Notes¶
We present here a few highlights of the new features in SPARK 27. You can access the complete list here.
Language Extensions¶
Support for functions with side-effects in more locations¶
Generally, SPARK forbids side-effects in expressions. Functions that perform side effects (modify a global or a parameter, propagate an exception…) need to have the Side_Effects aspect and can only be used in specific places. SPARK now supports calls to functions with side-effects in more contexts. In addition to the left-hand side of assignments and the initial value of objects declared outside of a declare block, it is now possible to call functions with side-effects directly in:
the initialization of an extended return statement;
the expression of a return statement;
the condition of an if/elsif statement;
the selecting expression of a case statement;
the condition of an exit statement; and
the condition of a continue statement.
These extensions make using functions with side-effects much more natural in SPARK, reducing the burden to translate existing Ada to SPARK.
Precise global and parameter modes by proof¶
In SPARK’s modular analysis, an in/out parameter of or global modified by a called subprogram is assumed to be completely and unconditionally modified by the call; developers are therefore required to state explicitly everything that is not modified and when, whenever greater precision is desired.
SPARK now provides the Modifies aspect, which allows developers to state when a parameter or global is modified and which parts, for composite types. For example:
type R is record
F1, F2 : Boolean;
end record;
type RR is record
G1, G2 : R;
end record;
procedure Write_G1_F1 (B : Boolean; X : in out RR) with
Modifies => X.G1.F1 when B;
procedure Write_G1_F1 (B : Boolean; X : in out RR) is
begin
if B then
X.G1.F1 := False;
end if;
end Write_G1_F1;
Referring to loop index in for .. of loops¶
Ada provides array component iterators and container element iterators using the for .. of syntax, which yields cleaner loop bodies than for .. in without the need to capture the current element in a constant declaration inside the loop. However, since SPARK uses induction to prove loops, for .. of generally cannot be used as the loop index is typically required in the loop invariant for induction.
SPARK now offers a new attribute 'Loop_Index that allows the current loop iteration to be retrieved from array components or container elements. This allows induction to be performed while using for .. of.
For example, it will be possible to write:
for E of S loop
if E = 0 then
C := C + 1;
end if;
pragma Loop_Invariant (C <= E'Loop_Index - S'First + 1);
end loop;
where previously the loop would have required for .. in, instead, to establish the bound on C using induction.
Referring to values at labels¶
SPARK developers can now use 'At to refer to the value of an object at a previous program point. Ada has provided ‘Old and ‘Loop_Entry, which allow the initial value of a subprogram parameter or the initial value of an object at the time a loop was entered to be referenced, respectively. Using ‘At, a developer can refer to the value of an object at a specific label, like this:
X := 1;
<<My_Label>>
X := 2;
pragma Assert ((X-1)'At (My_Label) = 0);
which is equivalent to
X := 1;
declare
Compiler_Generated_Unique_Name : constant Integer := (X-1);
begin
X := 2;
pragma Assert (Compiler_Generated_Unique_Name = 0);
end;
Precise support for overlays¶
Objects that share the same underlying memory region are referred to as overlays. SPARK now handles these objects precisely, in simple cases. As an example, we are able to prove the following code:
with Interfaces; use Interfaces;
procedure Test with SPARK_Mode is
type Four_Small_Ints is record
F, G, H, I : Unsigned_8;
end record;
for Four_Small_Ints use record
F at 0 range 0 .. 7;
G at 0 range 8 .. 15;
H at 0 range 16 .. 23;
I at 0 range 24 .. 31;
end record;
X : Unsigned_32 := 256;
Y : Four_Small_Ints with Import, Address => X'Address;
begin
pragma Assert (Y = (0, 1, 0, 0));
end;
This feature helps to enable zero-copy provable parsing of binary data into simple record types.
Refer to Discriminants of Unchecked Union Types¶
The discriminants of unchecked union types are not actually stored in memory. As a result, it is not usually possible to access it. SPARK now allows references to the discriminants of unchecked union types when they occur in non-executable ghost code (i.e., ghost code with an assertion level that depends on Static):
type Int_Or_Float (Is_Int : Boolean := True) is record
case Is_Int is
when True =>
My_Int : Integer;
when False =>
My_Float : Float;
end case;
end record with Unchecked_Union;
procedure Increase_Int_Value
(X : in out Int_Or_Float)
with
Pre => (Static => X.Is_Int and then
X.My_Int < Integer'Last),
Post => (Static => X.Is_Int and then
X.My_Int = X.My_Int'Old + 1)
is
begin
X.My_Int := X.My_Int + 1;
end Increase_Int_Value;
User Experience¶
Proof manifests¶
SPARK now offers proof manifests, an entirely new capability. Proof manifests are helpful in two situations:
to provide per-subprogram proof settings; and
to offer simpler, easier-to-use replay support for reproducing proofs in CI.
Proof manifests are TOML files that can be generated by calling gnatprove with --generate-manifest-dir and used by calling gnatprove with --proof-manifest-dir. Proof manifests offer hierarchical refinement: default settings placed on a unit can be overridden or augmented on a per-subprogram basis as needed.
Show if a proof comes from a cache¶
SPARK now offers insight into whether a proved check was (re)proved by the solvers on the current run or served from a cache (local or file-based memcached). This can help explain situations in which SPARK results appear to be nondeterministic and can aid in debugging memcached-based CI deployments of SPARK. When gnatprove is run with --report=provers, in addition to reporting which prover proved a given check, gnatprove reports which cache, if any, provided the proof.
Feedback on why provers stopped working on unproved checks¶
SPARK now provides information about why its provers stopped working on unproved checks.
Broadly speaking, provers stop working on checks for one of two reasons:
The provers reached configured resource limits. SPARK limits its provers with timeouts, step limits, and memory limits. If a prover stopped working because a given limit was reached, increasing that limit might result in a proved check.
The provers stopped working on the check even though resource limits were not reached. SPARK’s provers have internal heuristics that sometimes cause them to stop work early. This does not necessarily mean the check is proved false; it does mean that increasing timeout or step limit, for example, will not help.
SPARK now provides this information via new information appended to the check message:
[provers reached <limit> limit before completing the proof], where<limit>is one or more oftime,step, andmemory(e.g.[provers reached time and step limit before completing the proof]), or
[provers gave up before completing the proof]
In both cases, following the guidance in the section “How to Investigate Unproved Checks” of the SPARK User Guide remains our strong recommendation.
Provers are now staggered by default¶
If users request multiprocessing (-j switch), GNATprove runs provers in parallel on the same checks in a “race”, then stops the remaining ones if one prover found a proof. While this leads to faster results, it can also lead to wasted work when most checks are proved by one fast prover, which is quite common. Now, the first prover is run first with a small head start; subsequent provers are then run shortly afterwards, if the first prover has not already found a proof.
SPARKlib Improvements¶
Access-type conversions¶
Access-type conversions, like overlays, can be used to reinterpret a value of a given type as a value of another type. This is especially useful for providing a typed reinterpretation of binary data with zero copies. While overlays provide an effective means to accomplish this within a subprogram, access-type conversions allow the resulting typed reinterpretation to be exported for use by the rest of the program.
SPARK now supports access-type conversions safely via the SPARKlib. The result of the conversion is a borrow or an observe, integrating fully into SPARK’s ownership model.
Tree-container library¶
The SPARKlib now provides formal and functional generic trees. Like the other containers in the SPARKlib, developers can use these containers in their code and prove properties about the containers and the elements contained therein.
Linked Structures in Arrays¶
The Higher-Order part of the SPARKlib now provides functions for reasoning about acyclic linked structures stored in an array. They work on arrays that store one or several linked structures using a Next function: for each cell in the array, the index of the next cell is returned by Next.
The Reachability package defines three functions over these structures, along with some lemmas that can be used to reason over them. The function Reachable_Set returns the functional set of all the indices in the array that can be reached from X by calling Next repeatedly. Finally, the function Model computes a functional sequence that stores the indices reachable from X in the reverse of the order in which they occur: the first element of the sequence is the last index of the structure, the one whose Next is No_Index, and the last element is X itself.