-show-similar-overflows
Show all overflows in wrap-around mode
Since R2020b
Syntax
-show-similar-overflows
Description
-show-similar-overflows
causes all overflows to be shown in
wrap-around mode even if they come from the same root cause.
If you select warn-with-wrap-around
for the option Overflow mode for signed integer
(-signed-integer-overflows)
or Overflow mode for unsigned integer
(-unsigned-integer-overflows)
, values that overflow are wrapped. For instance,
the value INT_MAX + 1
wraps around to INT_MIN
. A path
with an overflowing value continues beyond the overflow with the wrapped value and can lead to
a similar overflow several lines later. By default, Code Prover detects overflows from the
same root cause and shows only the first of similar overflows. If you fix this overflow, the
subsequent overflows are also fixed. If you want to see all overflows in wrap-around mode, use
the option -show-similar-overflows
.
If you are running an analysis from the user interface
(Polyspace® desktop products only), on the Configuration pane, you can
enter this option in the Other field. See Other
.
Examples
In this example, the value of var
is unknown and edge cases can lead to
overflows in the operation *copy1 = var * 2
. The same edge cases also lead
to overflows in the next operation. Code Prover shows an orange Overflow
check on the first operation only.
int input(); void getEven(int* copy1, int* copy2) { int var; var = input(); *copy1 = var * 2; *copy2 = var * 2; }
If you use the option -show-similar-overflows
, Code Prover shows orange
Overflow checks on both operations.
int input(); void getEven(int* copy1, int* copy2) { int var; var = input(); *copy1 = var * 2; *copy2 = var * 2; }
Version History
Introduced in R2020b