The Astrée run-time error analysis can now be applied
to C++ and mixed C/C++ code bases. The new astree-cxx
analysis mode supports all modern C++ versions up to C++17 and many
of the features known from the classic C code analysis.
Astrée’s C++ analysis uses the same technology as its C code analysis. It is designed to meet the characteristics of safety-critical embedded software, and is subject to the same restrictions as Astrée for C.
The high-level abstraction features and template library of C++ facilitate the design of very complex and dynamic software. Extensive use of these features may violate the established principles of safety-critical embedded software development and lead to unsatisfactory Astrée analysis times and results. The Astrée manual gives recommendations on the use of C++ features to ensure that the code can be well analyzed. For less constrained (less critical) C++ code, we recommend using the standalone RuleChecker.
congruence-intervals
is enabled__astree_memcpy
__ASTREE_global_assert
directive are now
cut to the asserted range in more cases, resulting in more precise results.__ASTREE_modify
directive, the result is now a strictly invalid pointer.__ASTREE_modify
directive, the variable
is set to its full integer range.memcpy
.
Instead it copies their indeterminate values to the memcpy
target and issues warnings
if those bytes are read later. The new behavior eliminates false alarms when
memcpying padding bytes while still catching the relevant undefined behaviors of C.__astree_bzero
or __ASTREE_modify
writes to all cells of a smashed array, the array is now considered initialized. This eliminates subsequent false alarms about reading from an uninitialized variable.memcpy
is a dangling pointerNULL > NULL
)>
, >=
, <
, <=
)
if one of the operands is an invalid pointerglobal_assert_failure
for distinguishing
assertion failures reported for __ASTREE_global_assert
directives
from assertion failures reported for __ASTREE_assert
directives.__ASTREE_attributes
allows annotating functions
and original source files with pre-defined attributes that modify the analyzer's
behavior when analyzing them. The following attributes are available:
coverage_ignore
raise_at_caller
cut-arithmetic-operations-on-null
forces the analysis to cut
all traces leading to arithmetics on null pointers. This new option is disabled by default.equality
controls the
equality relational domain, which tracks sets of known equal variables.
This domain was formerly only available as part of the filter domain.
This new option is disabled by default.dump-escaping-locals
extends the option dump-dataflow
to report reads and writes of non-static local variables occurring outside of
the function in which they are defined. The option is enabled by default.automatic-octagon-packing
disables the automatic creation of octagon packs without disabling
the octagon relational domain. Octagon packs can still be created
using the __ASTREE_octagon_pack
directive.
The new option replaces the former undocumented support option
automatic-pack
which is no longer accepted by the analyzer.__ASTREE_assert
and __ASTREE_check
directives no longer print the code of the failed directive. To see the asserted or checked
expression, please refer to the code snippet that is printed after the alarm message.null_pointer_dereference
→ invalid_pointer_dereference
invalid_memcpy
→ invalid_memory_operation
read_data_race
→ read_write_data_race
write_data_race
→ write_write_data_race
recursive_function
→ ignored_recursive_call
analysis-entry
has changed to main
.__ASTREE_volatile_input
and __ASTREE_global_assert
.
Such variants are now reported as violations of the diagnostic check
invalid-directive
.invalid_pointer_comparison
alarms
in relational comparisons
(>
, >=
, <
, <=
)
of integers, usually resulting from violations of the diagnostic rule A.3.1.for
loops as either
for (; condition; increment) { loop-body }
for (init; condition; increment) { loop-body }
int i,j;
) as single statement.__ASTREE_modify
directive,
it may now cut invalid values. For example, if ptr may be NULL
before __ASTREE_modify((*ptr))
, then Astrée raises a class A alarm
for dereferencing NULL
and continues assuming ptr != NULL
.
If all values are invalid, the analyzer reports an error.
__ASTREE_modify
directive
may overflow the destination type, the bound is now replaced
by the minimum/maximum of the destination type.x
has an unsigned integer type, then
__ASTREE_modify((x; [-10, 10]))now sets
x
to the range [0,10]
instead of ignoring the effect of the directive.
The invalid interval is still reported.continue-on-definite-rte
is set
and a loop is found definitely non-terminating, then the exit condition
of the loop is ignored so that the analysis continues after the loop.Fixed exceptional aborts of the analyzer that could occur:
continue-on-definite-rte
was enabled,congruence-intervals
was enabled,__ASTREE_wrapper_call
directiveassume-unknown-pointers-are-valid
and dump-data-dictionary
at the same time.shift-width-constant
(M.12.8, M2008.5.8.1, AUTOSAR.5.8.1M, X.A.5.39),
essential-shift-width
(M2012.12.2), andprecision-shift-width
(CERT.INT.34).local-function-typedef
(rule X.E.5.2.2.11)
warns about block-scope function type definitionsunreachable-code-after-jump
(M.14.1, M2012.2.1,
CERT.MSC.12, CWE.561)
reports code following jump
statements in the same block,
which is trivially unreachablesigned
/unsigned long long
when c-version
is set to C90
,
which constitutes a language extension.max-parameters
(M.1.1,
T.6.1, X.C.LIB.6,
and X.D.8.1.e)max-number-of-called-functions
(T.10.1)min-number-of-calling-functions
(T.11.1)max-number-of-calling-functions
(T.11.2)max-number-of-recursive-paths
(T.12.1)unreachable-code
has been linked
with rule CWE.561.unsupported-language-feature-fatal
(diagnostic rule A.5.3) now also warns
about uses of variably modified types (including variable length arrays)
that cannot be analyzed with Astrée.flexible-array-member
(M2012.18.7)
has been extended to flexible array members in structures
containing no other members (accepted C language extension).empty-struct
(A.2.17)
has been extended to report structures containing only
a flexible array member (accepted C language extension).unsupported-language-feature-fatal
(A.5.3)
now also warns about the use of variable length arrays
and variable modified types with side effects,
as these cannot be analyzed with Astrée.side-effect-in-conditional
(X.E.5.2.1.2)
has been restricted to the first operand of the conditional operator.unused-suppress-directives
(B.1.2)
now also warns about unused suppress and comment directives that are inserted via AAL.evaluation-order
(rule A.4.1,
CERT.EXP.10, CERT.EXP.30,
M.12.2-required, M2012.1.3-required,
M2012.13.2-required, X.A.5.34).
It now also considers writes via array look-ups in a called function.distinct-macro
(M2012.5.4)
for code containing #undef
directivesstdlib-limits
(M.20.3,
M2012.D.4.11, CERT.FLP.32)
which warned about the second parameter of pow
or powf
being 0
object-type-mismatch
(M2012.8.3),
which warned about compliant array declarations that differed only
in the array size specification, such as
int x[]; int x[10];
array-initialization
(M2012.9.3)
which did not warn about incomplete initializer lists initializing a sub-array
inside of a multi-dimensional array, such as in
int a[2][3] = {{1, 2}, {4, 5}};
distinct-ordinary
(M2012.5.2), which did not warn
about identifiers with external linkage when not being distinct
from identifiers without external linkage (which is correctly
not reported by the check distinct-extern
).distinct-tags
(M2012.5.2) which did not warn
about forward-declared enum tags without definition.extra-tokens
(M2012.20.13, M.19.16, X.E.5.2.5.2)
which did not warn about non-compliant #line
directives.field-overflow-upon-dereference
(CWE.118, CWE.119, CWE.120,
CWE.121, CWE.122, CWE.123,
CWE.125, CWE.126, CWE.127,
CWE.129, CWE.131, CWE.680,
CWE.823)
which did not report violations if the corresponding Astrée
option warn-on-field-overflows
was not enabled.whitespaces-around-array-brackets
(rule X.D.7.1.e)
which did not warn about missing spaces in abstract array declarators
with no further inner declarator, such as in
sizeof(int [ 10 ] )
#elif
directives
that are not reached by the preprocessor.#elif
directives
that are not reached by the preprocessor for rule checks
macro-undefined
(M.19.11,
M2012.20.9) and
if-value
(M2012.20.8).invalid-directive
.__has_include
and __has_include_next
.
The arguments to these builtin macros had not been subject to macro expansion.composite-type-width
.float-comparison
to also cover indirect
(in)equality tests of the forma - b < c || b - a < cand
a - b <= c && b - a <= c
parameter-name-match
(AUTOSAR.8.4.2M, M2008.8.4.2)
are now reported with a reference to the conflicting preceding declaration.expression-statement-line
(AUTOSAR.7.1.7A)
at __ASTREE_*
directives.missing-non-generic-copy-assignment
(M2008.14.5.3, AUTOSAR.14.5.3M) and
missing-non-generic-copy-constructor
(M2008.14.5.2).=delete
for the following checks:
assignment-operator-without-ref-qualifier
(AUTOSAR.12.8.7A)output-parameter
(AUTOSAR.8.4.8A)public-abstract-copy-assignment
(M2008.12.8.2)unused-local-variable
(M2008.0.1.3, AUTOSAR.0.1.3M)
for unnamed exception declarations in catch handlers and objects
with user-provided constructor or destructor such as std::unique_lock
. precedence
(AUTOSAR.5.0.2M, M2008.5.0.2)
for overloaded operators such as <<
used with streams.logop-postfix-operand
(M2008.5.2.1)
for overloaded operators.single-use-pod-variable
(AUTOSAR.0.1.4M, M2008.0.1.4),
that erroneously reported a compliant identifier as non-compliant if
plain-char-operator
(AUTOSAR.4.5.3M, AUTOSAR.5.0.11M,
M2008.4.5.3, M2008.5.0.11)
for operand expressions of type signed char
/ unsigned char
(as opposed to plain char
).external-file-spreading
(AUTOSAR.3.2.3M, M2008.3.2.3)
caused by friend declarations.c-style-initialization
(AUTOSAR.8.5.2A)
in for-range-declarations (see [stmt.ranged]).hexadecimal-lower-case-digit
(AUTOSAR.2.13.5A)
which did warn about user-defined literals if the ud-suffix contained one of the letters 'a' to 'f'.hexadecimal-lower-case-digit
(AUTOSAR.2.13.5A)
which did not warn about non-compliant floating literals.integral-type-name
(AUTOSAR.3.9.1A, M2008.3.9.2),
wchar-t
(AUTOSAR.2.13.3A),
long-double
(AUTOSAR.0.4.2A) and
volatile
(AUTOSAR.2.11.1A) which did not warn about template arguments.underlying-cvalue-conversion
(AUTOSAR.5.0.3M, M2008.5.0.3) no longer warns about
nullptr_t
void*
pointers
member-function-missing-const
and member-function-missing-static
(AUTOSAR.9.3.3M, M2008.9.3.3)
no longer report virtually overriding
methods which have to follow the signature of the method they override.min-instructions
(T.5.1)
and false negatives for the check max-instructions
(T.5.2).Added support for the following rules:
astree
.
C++ features are available in the analysis modes
astree-cxx
and rulechecker
.__ASTREE_attributes
directive).
This only works for top-level insertions (file scope).<preprocess> <config name="My C files"> <language>C <!-- Mandatory in DAX 1.10. --> ... </config> </preprocess>
<rulechecks import="file.dax" name="my configuration"> ... </rulechecks>
<rulechecks import="file.dax"/>
,
all configurations are imported as individual configurations.
name
attribute are implicitly
named “Configuration”.long long
.--export
--export-aal
--export-only
--export-preprocessed
--queue
__ASTREE_comment
directives with file name parameter.dump-escaping-locals
.--id
) no longer updates
the original source files on the server.config-file
option.with option <empty>
instead of only with option
. For example:
A.5.2 (full: pragma-usage, unsupported-language-feature) with option <empty>
options=""
or value=""
, respectively.When upgrading to a new version, the server controller now imports the server settings of the previous installation.
__volatile
as a keyword alias of volatile
.sizeof_float
, sizeof_double
,
and sizeof_long_double
.__ASTREE_comment
and __ASTREE_suppress directives
.
Unknown alarm keys and comment classifications are now reported
as violations of the check invalid-directive
(diagnostic rule A.5.1)
instead of leading to fatal parse errors.__ASTREE_boolean_pack
and __ASTREE_octagon_pack
are no longer reported as errors, but as violations of the diagnostic rule check
invalid-directive
(A.5.1).__typeof(f)
where f
is an expression with function type.int *p; while(p = &(int){0}, 0) { ... } /* The compound literal is out-of-scope, so 'p' is now a dangling pointer. */
anonymous-global-structs-and-unions
enabled,
the C frontend also created global instances of struct types with tag,
which in rare cases caused name conflicts during parsing. This has been fixed.strtok
now modifies its first argument.INT16_C
, INT32_C
,
and INT64_C
in the C stub library implementation
which added inappropriate unsigned suffixes for certain ABI settings.osSystemExtendedTask
and osSystemBasicTask
to enable automatic integration analysis from ARXML files.
The #undefs for osSystemExtendedTask
and
osSystemBasicTask
can be disabled by adding
the define ASTREE_KEEP_EXTENDED_BASIC_TASK
.osek.h
header file can be included
in the analysis by simply adding its include path to the preprocessor
configuration. If necesssary, inclusion of the vendor-specific
osek.h
can also be prevented by adding the define
ASTREE_SKIP_USER_OSEK_H
.ASTREE_USE_MONO_CORE
to the preprocessor configuration
for AUTOSAR OS also enforces a single core OS setup.
Adding the define ASTREE_USE_ANY_CORE
configures all applications to run on any core.Three test cases have been renamed:
The test cases qk_option_checks
,
qk_option_cxx_version
, and
qk_option_rules
have been removed from the Astrée QSK.
The test cases qk_option_checks
and qk_option_rules
have been removed from the RuleChecker QSK.